Beginner wrote:

On 21 Mar 2007 at 0:00, Jeff Pang wrote:

1) use lib '/path/to/somedir';

2) unshift @INC, '/path/to/somedir';


This can't work when you add a path to @INC on runtime.

BEGIN {
    unshift @INC,'/path/...';
}

Do you mean you have to put it in a BEGIN block to work?

Yes. Because all 'use' statements are executed at compile time, adding
directories to the path at run time is of no use: by then Perl will have
looked in the directories in the unmodified @INC list and either failed
to find the module or loaded a different copy of it.

Rob


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to