in reply to Re^2: Do modules know the callers full path?
in thread Do modules know the callers full path?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Do modules know the callers full path?
by Anonymous Monk on Feb 15, 2023 at 21:42 UTC | |
by LanX (Saint) on Feb 15, 2023 at 22:19 UTC | |
by Anonymous Monk on Feb 15, 2023 at 22:29 UTC | |
by LanX (Saint) on Feb 15, 2023 at 23:16 UTC |