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.
In reply to Re^2: use lib problem.
by ikegami
in thread use lib problem.
by tanger
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |