more useful options | |
PerlMonks |
Re^2: distribution config fileby rinceWind (Monsignor) |
on Jun 19, 2006 at 15:27 UTC ( [id://556269]=note: print w/replies, xml ) | Need Help?? |
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. --
In Section
Seekers of Perl Wisdom
|
|