in reply to Re^2: using file::find::name and file tests
in thread using file::find::name and file tests
the File::Find docs (and a quick warn tossed into OP's first code) say that $File::Find::name is the 'Complete pathname to the file', and not relative and all the examples given in the The wanted function section indicate the same thing..Let's recap... yes it is the complete path, but constructed from the original parameter. If you start with ".", your path will look something like "./path/to/file" which, as merlyn said, won't work as the cwd is changed to the directory the current file is in, every time.
So, if you want an absolute path, start out with absolute paths. rel2abs from File::Spec::Functions can do wonders. You don't have to use in it the callback, just apply it to every parameter you pass to find.
Now you'll get absolute paths.use File::Spec::Functions 'rel2abs'; find sub { blah blah } map rel2abs($_), @dirs;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: using file::find::name and file tests
by davidrw (Prior) on May 07, 2006 at 14:00 UTC |