Not sure what you're expecting to happen when you say it didn't change. Are you expecting to manipulate @INC permanently? That's not how it works. use lib ... changes @INC only for the lifetime of the script. Also, use lib doesn't take a space-separated string of directories, but a list of directories, if you need more than one.
Consider this:
#!/usr/bin/perl -wl
use strict;
BEGIN { print for @INC; print "-----" }
use lib "/usr/share/perl5/vendor_perl/AnyEvent/Iml", "/foo/bar";
BEGIN { print for @INC; print "-----" }
# use here whatever module lives in one of the added paths...
$ ./955116.pl
/etc/perl
/usr/local/lib/perl/5.12.4
/usr/local/share/perl/5.12.4
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.12
/usr/share/perl/5.12
/usr/local/lib/site_perl
.
-----
/usr/share/perl5/vendor_perl/AnyEvent/Iml
/foo/bar
/etc/perl
/usr/local/lib/perl/5.12.4
/usr/local/share/perl/5.12.4
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.12
/usr/share/perl/5.12
/usr/local/lib/site_perl
.
-----
As you can see in the second printout of @INC (after the use lib), the two directories have been added.
___
P.S.: please use <p>...</p> (text paragraph) and <c>...</c> (code) tags to format your posts.
For example, typing
<p> inserting into the script: </p>
<c>
use lib "/usr/share/perl5/vendor_perl/AnyEvent/Iml";
</c>
<p> also does not change the entry. </p>
will render as
inserting into the script:
use lib "/usr/share/perl5/vendor_perl/AnyEvent/Iml";
also does not change the entry.
|