Drawbacks of AUTOLOAD
Learn about the drawbacks of using AUTOLOAD.
We'll cover the following
AUTOLOAD()
can be useful, though it’s difficult to use properly. The naïve
approach to generating methods at runtime means that the can()
method won’t
report the right information about the capabilities of objects and classes.
Easiest solution
The easiest solution is to predeclare all functions we plan to AUTOLOAD()
with the
subs
pragma:
Get hands-on with 1400+ tech skills courses.