should work. '=' allows you to pass an argument to the module so -Mlib=. is the same asperl -Mlib=. -MFoo::Bar -e 'print barfoo("blah");'
which does an unshift for you but it does it at compile time and before the -MFoo::Bar happens.use lib '.';
Updated Broquaint makes a good point, Bar.pm must be the in Foo directory in . I was going to say also that -I. is wrong but it's not wrong it's just weird.
My first reaction was to suggest -I but when I checked it with
I didn't see . at the start of @INC so I switched to -Mlib=. Then I looked again and I saw that -I. does not not put . at the start of the search path, for my perl, it putsperl -I. -e 'print join("\n", @INC)'
which will probably have the same effect. Where is it documented that -Idir will add dir and 6 other variations of dir to the search path? Or is that just some weirdness from perl on Fedora Core 2?./5.8.3/i386-linux-thread-multi ./5.8.3 ./i386-linux-thread-multi ./5.8.2 ./5.8.1 ./5.8.0 .
In reply to Re: perl -M using a module in current dir
by fergal
in thread perl -M using a module in current dir
by electrosphere
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |