No such thing as a small change | |
PerlMonks |
Re: How to determine absolute path of current Perl file?by Tanktalus (Canon) |
on Feb 29, 2016 at 22:27 UTC ( [id://1156486]=note: print w/replies, xml ) | Need Help?? |
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 :)
In Section
Seekers of Perl Wisdom
|
|