My program like this,but it is not work.Perl report "Can't locate object method "dirname" via package" . I think it is because BEGIN is running before any other perl statement.
And I don't know which is the script directory because it is running as cron job. So I can't use use lib "./lib" too. So how can I use my own lib if I don't want edit PERL5LIB enviorment?
thanks!use File::Basename; use My:Ownmodule; BEGIN { my $cwd = dirname $0; my $mylib = $cwd."/lib"; unshift (@INC,$mylib); }
In reply to newbie question: can't use my own lib in crob job by iwanthome
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |