in reply to eval "require $module" vs. Module::Load::load($module)
Both of your methods hide the actual value of $@, which I consider a horrible design idea. $@ often contains valuable information and hiding that from the users/programmers makes for ugly debugging. Personally, I prefer the following idiom:
my $filename = $module; $filename =~ s-(::|')-/-g; $filename .= '.pm'; require $filename; # dies with an informative message
Looking at Module::Load, it again contains many weirdo checks that I have come to distrust when it comes to load failures - far too often I've had syntax errors in my modules hidden by UNIVERSAL::require to want such ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: eval "require $module" vs. Module::Load::load($module)
by moritz (Cardinal) on Aug 17, 2007 at 15:38 UTC | |
by Corion (Patriarch) on Aug 17, 2007 at 15:40 UTC | |
by djerius (Beadle) on Aug 17, 2007 at 16:12 UTC | |
|
Re^2: eval "require $module" vs. Module::Load::load($module)
by djerius (Beadle) on Aug 17, 2007 at 14:37 UTC | |
by Corion (Patriarch) on Aug 17, 2007 at 14:41 UTC | |
by djerius (Beadle) on Aug 17, 2007 at 14:59 UTC |