in reply to How to determine absolute path of current Perl file?
Avoiding filters: good.
Avoiding PadWalker: mind saying why?
Given my experience with PPI, I'm going to guess that you'll have a larger dependency list and more fragile code than if you used PadWalker.
Having said that, if you want the full path name to the current file, just use __FILE__. And if you want the full path name to the file that just called you, just use (caller)[1]. As a bonus, caller will also give you the line number that you were called from.
I'm not sure what else you're looking for, but I'd like to discourage the use of PPI for this. I do use PPI to parse and rewrite code, and that was marginally painful. This just seems ... well, really painful. The authors of PPI may have differing opinions :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to determine absolute path of current Perl file?
by hakonhagland (Scribe) on Mar 01, 2016 at 09:58 UTC | |
by LanX (Saint) on Mar 01, 2016 at 13:29 UTC | |
by Your Mother (Archbishop) on Mar 01, 2016 at 13:01 UTC |