in reply to Re: distribution config file
in thread distribution config file
There are two approaches to writing portable code to deal with paths. All systems running perl can cope with POSIX filenames, i.e. using '/' as a path separator. This works except when performing textual manipulation on a file spec in native format, though Windows can sometimes cope with a mixture of forward slashes and backslashes.
The other approach is to use File::Spec, Cwd and friends in conjunction with the native syntax. If you do this, stick to native syntax throughout. Note that some OSes e.g. VMS, don't have a single 'path separator' but something more complicated.
For more on this, see perldoc perlport and my YAPC portability talk slides.
By the way, I don't think your approach will work in the OP's case.__FILE__ is an alias for $0 as far as I am aware, so this may not contain any path separators at all.
--
Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ?
(Missquoting Janis Joplin)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: distribution config file
by IOrdy (Friar) on Jun 20, 2006 at 00:22 UTC |