Paul, there is already a File::Spec module written by Kenneth Albanowski (kjahds@kjahds.com) and available on CPAN : >This module is designed to support operations commonly performed on file >specifications (usually called "file names", but not to be confused with the >contents of a file, or Perl's file handles), such as concatenating several >directory and file names into a single path, or determining whether a path >is rooted. It is based on code directly taken from MakeMaker 5.17, code >written by Andreas KE<ouml>nig, Andy Dougherty, Charles Bailey, Ilya >Zakharevich, and others. I started to use it to maintain one code base for Linux, Win32 and MacPerl. The only missing part at this time is the File::Spec::Mac implementation. It would not be hard to do it but I haven't found the time until now. Georges Martin >At 7:57 PM -0800 2/16/98, Brian "L." Matthews wrote: > >} >} |On a simpler concept, I am working on hiding path problems by using a >} |variable for the path deliminator, and setting the variable based upon >} |environment variables. >} >} For a general purpose module, this would be necessary but not >} sufficient. For example, a////b on Unix is very different from a::::b >} on a Mac. And what does a path of / mean on a Mac? And I'd expect >} a Homogeneous.pm to "do the right thing" with paths like /dev/tty or >} /tmp/xxx. > >Exactly. My own thinking along these lines has been something like > >$relative = Path::relative("MacPerl","lib"); >$absolute = Path::absolute("usr","local","bin","perl"); > >with reverse routines that parse platform specific paths as well. You >can't use ".." as up; the safest would be to use undef. You've got to >reconcile Unix's "anything but a /" with Mac "anything but a :". You've >got to guard against names that are too long, you've got to allow "." and >".." as plain file/directory names on anything but Unix (and I don't mean >converting them to ":" and "::"; "." and ".." are legal names). I could >write these for Unix/Mac pretty quickly, but now add in *all* the other >operating systems that Perl runs on. > >The join(":",split("/")) works ok for the typical path, but if you're going >to "write and forget" conversion routines, you'd better guard against all >the atypical cases as well. Recently on the Alpha list it was discovered >that Alpha simply wouldn't work right if there were "funny" characters in >the names of folders in the path.s (I don't remember at the moment, but I >think it was funny characters in the absolute path, which means that you >can break Alpha simply by moving it.) This must be a Tcl limitation, but I >consider it a serious bug. In as much as possible, Mac users should be >free to name their files/folders what they want to. +-----------------------------------------------------------------------+ Georges Martin <mailto:georges.martin@deboeck.be> +-----------------------------------------------------------------------+ "We reject kings, presidents, and voting. IETF Credo We believe in rough consensus and running code." Dave Clark (1992) +-----------------------------------------------------------------------+ ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch