in reply to How could you make a script think it's running in its own directory?
I prefer File::Basename for that:
use File::Basename; my $base = dirname $0; chdir $base or warn "Couldn't find base directory '$base'. Using current direc +tory.";
This fails if you have weirdo symlinks pointing around. There is FindBin which goes through weird contortions to cover special cases but opens up other venues of failure cases.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How could you make a script think it's running in its own directory?
by Anonymous Monk on Mar 27, 2008 at 09:28 UTC | |
by why_bird (Pilgrim) on Mar 27, 2008 at 10:06 UTC | |
by parv (Parson) on Mar 27, 2008 at 10:48 UTC |