Flip-flop. Flippity-flop goes my braine.
I've decided not to change the behavior of UNIVERSAL::require. Why?
1) Jesse's suggestion of using $@ instead of $UNIVERSAL::require::ERROR. It makes the error checking code much less disgusting to type.
2) The existing behavior has survived four years without anyone hating it enough to file a bug or patch.
3) Its such a simple module its not worth the turmoil.
Re:Could you still have an option to make it die?
schwern on 2005-10-08T08:45:06
I've thought about that. It seems silly given my reasons for wanting to make it die.
1) People would write$module->require
without realizing it wouldn't die on error.
Well,require_or_die()
doesn't help with that. If they don't think$module->require
doesn't die they'll probably never noticerequire_or_die()
.
2)$module->require or die $UNIVERSAL::require::ERROR
is nasty.$module->require or die $@
is nearly as short as$module->require_or_die
So not really worth it.Re:Could you still have an option to make it die?
tyan on 2005-10-13T11:03:17
How about an option when you use the module:
use UNIVERSAL::require qw/fatal/;
SomeModule->require; # blows up?
Re:Could you still have an option to make it die?
schwern on 2005-10-14T23:14:31
Already covered why that won't work.