After seeing it go by in my RSS feed I tried this out yesterday and I love the idea. As Steven Haryanto mentioned in his review, there are already other modules that do what this one does, but I like that L is so short that I don't think twice about using it for one-liners. Something to note is that of the modules Steve mentioned, only Class::Autouse does the exact same thing (automatically load a module when a method or sub is called on its namespace). The others will install missing modules from the CPAN when code wants to load them, but not automatically load them without a use or require statement.
There are a few minor reasons it doesn't get 5 stars though.
The most important is that this uses a somewhat dangerous and brittle hack, and a cursory look at the code leads me to think it could cause some unexpected behavior in some cases. (I'll file bugs if I stumble on any :). That said, the documentation clearly states that this is only intended for one-liners, and in that case, I've no problem with adding an AUTOLOAD to UNIVERSAL in exchange for such convenience.
Of less importance is that I'm not too keen on dists that take up a 1-character top-level namespace, even for something so useful. Two or three would be better, and still less typing than the alternatives.
Finally, I'd love it this eventually included some mechanism to try to download & install missing modules into a local::lib or something like that, perhaps reading an rc file in the user's home directory. Something like -ML=i, or -MLi=~/p5tmp (make/use p5tmp as a local::lib) Maybe just depend on lib::xi and be done with it.
My thinking? Since it's already doing a little black magick, it might as well go full-on warlock.
[edit: added some more info on alternatives]
1 out of 1 found this review helpful. Was this review helpful to you? Yes No
Reinvents Class::Autouse (written 12 years ago). But at least L is much simpler and shorter to type (the equivalent of -ML is -MClass::Autouse=:superloader).
BTW, there's also Module::AutoLoad, Module::AutoINC, and lib::xi which can automatically install modules from CPAN and load them upon first use.
2 out of 2 found this review helpful. Was this review helpful to you? Yes No