As I go back through my old modules, sometimes I wonder why I made certain choices. Today its UNIVERSAL::require which is used a whole lot more than I thought.
0.02 Mon Jun 25 15:00:19 EDT 2001 * -->API CHANGE!<-- require() no longer dies on failure
http://cpants.perl.org/dist/UNIVERSAL-exports
Seems quite similar to what gonzui says...
Re:another list
schwern on 2005-09-29T22:42:47
Curses! I really wish I could just break compat because dying really is the better thing to do. Maybe I'll throw in a "use UNIVERSAL::require qw(die)" or something.
Re:I wish...
schwern on 2005-10-01T19:00:52
If it wasn't in UNIVERSAL the module wouldn't work. The require method has to exist and be in a class' inheritence hierarchy *before* the class to be required is loaded.
And this really is the sort of thing which should be universal.Re:I wish...
perrin on 2005-10-03T21:47:21
It only has to be in UNIVERSAL because of the particular API you chose. It would be just as useful as something like this:
Module::Loader->load($module_name);
What bugs me about the current approach is that when I use a CPAN module that loads this, it magically adds require() methods to all of my classes, whether I want them or not.
Re:I wish...
schwern on 2005-10-09T20:34:41
Yep, but I can't exactly back out of that now. Remember, UNIVERSAL::require is an implementation of a Perl 6 RFC. People started using it. Go figure.It only has to be in UNIVERSAL because of the particular API you chose.require() is a special case. You're highly unlikely to create a method called "require" as its already a keyword. And, really, its something that classes should be able to do themselves.What bugs me about the current approach is that when I use a CPAN module that loads this, it magically adds require() methods to all of my classes, whether I want them or not.