in reply to an ever-available file for opening
Firstly, there are many circumstances where it can end up holding a relative path to the script, rather than an absolute one. If you then chdir, the relative path won't make sense. So don't do that.
Secondly, $0 is meaningless when perl is interpreting standard input. So don't do that either.
Other than that, I think you're golden. By definition the current process *must* have sufficient permission to read the script file, or it can't run it. So unless there's some bizarre suid situation I'm not considering, it should always be safe to open.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: an ever-available file for opening
by plobsing (Friar) on Jan 16, 2008 at 05:54 UTC |