in reply to Re: Re: Re: Dynamic "use lib"
in thread Dynamic "use lib"
BEGIN { if (@INC) { use lib '/foo'; } else { use lib '/bar'; } } print "INC IS: @INC\n";
Running this code you can see that the 'if' did not effect the 'use' statements. That's because 'if' is a run-time operator and 'use' is a compile-time statement. See:
$ perl begin.pl INC IS: /bar /foo /usr/local/lib/perl5/5.6.1/i686-linux /usr/local/lib +/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.6.1/i686-linux /usr/loc +al/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl .
-sam
|
|---|