"I wonder why Perl doesn't use the failure to load a method or function, because the module isn't loaded, as an opportunity to look for it and load it."
Very few languages will automatically attempt to load a class/package/module when you try to use one which isn't defined yet. Off the top of my head, I can only think of one that will — PHP, and it doesn't do so by default.
With Perl, such a feature might cause unexpected behaviour sometimes. For example:
local $Data::Dumper::Indent = 1; print Data::Dumper::Dumper($thing);
If calling Data::Dumper::Dumper() autoloaded Data::Dumper, then the autoloading would set $Data::Dumper::Indent to 2 (see the source of Dumper.pm for why) so you'd get the wrong indentation.
These kinds of bugs would probably be pretty hard to track down. Load order bugs are tricky enough to figure out already when the order modules are loaded can be seen pretty clearly in the source code; adding in autoloading would make things even worse.
While -ML is pretty handy for one-liners, having that feature enabled in anything bigger could be a nightmare.
In reply to Re^5: Perl 28 broke L: How to fix?
by tobyink
in thread Perl 28 broke L: How to fix?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |