in reply to use lib problem.

Hi,
Seems an odd thing to be doing - but it should work if you do it in a BEGIN{} block:
BEGIN { my $mod_path = '/home/tanger/www/mods'; use lib $mod_path; }; use Email::Valid;
Cheers,
Rob

Replies are listed 'Best First'.
Re^2: use lib problem.
by ikegami (Patriarch) on Jun 01, 2007 at 14:22 UTC

    This was covered recently. Your solution doesn't work because the assignment is still executed after the use. The use statement finishes compiling before the BEGIN statement, so it's executed first. A fix:

    my $mod_path; BEGIN { $mod_path = '/home/tanger/www/mods'; } use lib $mod_path; use Email::Valid;

    Follow the above link for alternative solutions.