http://www.perlmonks.org?node_id=11158524


in reply to Perl doesn't give error when module is not found 2

I can't reproduce the problem:

a.pl

#!/usr/bin/perl use warnings; use strict; use lib '.'; use MyModule; MyModule::call();

MyModule.pm

package MyModule; use warnings; use strict; sub call { MyModule2::authorize(); } __PACKAGE__

MyModule2.pm

package MyModule2; use warnings; use strict; sub authorize { print "auth\n"; } __PACKAGE__

Running ./a.pl results in the following error:

Undefined subroutine &MyModule2::authorize called at MyModule.pm line +6.

Update: It starts working when I include

use MyModule2;
into MyModule.pm or a.pl: but the correct way is the former, as the script shouldn't care about what its dependecies need to load.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]