I knew there was a reason like that but was puzzled when it worked without eval. Thanks for explaining. I forget to load modules and -ML is less punishment so you can imagine how much I like L! 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. For example:
Can't locate object method "bar" via package "Foo" (perhaps you forgot to load "Foo"?) at -e line 1. (Perhaps Perl, or perhaps *you* forgot to load "Foo" so object method "bar" can be located? ;-)perl -e 'Foo->bar'
package Foo; sub bar { print "baz\n" } 1perl -e 'print qq~package Foo; sub bar { print "baz\\n" } 1\n~' > Foo. +pm; cat Foo.pm
bazperl -I. -MFoo -e 'Foo->bar'
bazperl -I. -ML -e 'Foo->bar'
bazperl -I. -e 'eval{Foo->bar};$_=$@;s/.*forgot to load "([^"]+)".*/$1/s; +eval{require"$_.pm"};Foo->bar'
package X; { package UNIVERSAL; our $AUTOLOAD; sub AUTOLOAD { warn "$AUTOLOAD" }} 9perl -e 'print qq~package X; { package UNIVERSAL; our \$AUTOLOAD; sub +AUTOLOAD { warn "\$AUTOLOAD" }} 9\n~' > X.pm; cat X.pm
I don't know what this means:perl -I. -MX -e ''
IO::File::DESTROY at X.pm line 1. IO::File::DESTROY at X.pm line 1 during global destruction. IO::File::DESTROY at X.pm line 1 during global destruction. IO::File::DESTROY at X.pm line 1 during global destruction. IO::File::DESTROY at X.pm line 1 during global destruction.But this!
Yesperl -I. -MX -e 'Foo->bar'
IO::File::DESTROY at X.pm line 1. Foo::bar at X.pm line 1. IO::File::DESTROY at X.pm line 1 during global destruction. IO::File::DESTROY at X.pm line 1 during global destruction. IO::File::DESTROY at X.pm line 1 during global destruction. IO::File::DESTROY at X.pm line 1 during global destruction.I know what line 2 means! Perl knows what it means. Why doesn't she connect the dots automatically? I guess it would lead to all sorts of chaos and... L! Is L searching @INC in the background with Module::Load to find Foo.pm (and say Bar->foo that doesn't exist), and that's somehow dangerous (according to L docs)?
In reply to Re^4: Perl 28 broke L: How to fix?
by Anonymous Monk
in thread Perl 28 broke L: How to fix?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |