No it returns the current directory where you invoked perl. Well at best, a previous chdir will mess it up.
you should test with perl starting from another dir.
perl \tmp\script.pl
my $script = abs_path($0) is your best bet yet, just cut of the filename if you want the dir only
I don't think you need a BEGIN block if you put this at the very start of your module.
Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery
In reply to Re^3: Do modules know the callers full path?
by LanX
in thread Do modules know the callers full path?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |