[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] "Epoch-making difference"--time()



At 10:08 AM 4/5/96, Paul Schinder wrote:
>What would be nicer is if Config.pm lost a lot of its Unixcentrism and
>contained some actually useful stuff for the local configuration.
Legal filename characters will almost always be a problem that cannot be
handled by mapping functions -- In any case, it will be required that any
cross-platform file naming system be restricted in its character set.
>. . .what character begins a relative path, what
Characters -- on Unix "./" begins a relative path.
>character begins an absolute path, etc., etc.  Maybe even some simple
>routines that can construct legal paths out of lists, extract the filename
> from a legal full path, etc.  *That* would be useful for everyone, and
>would make writing portable Perl much easier.

Has anyone looked at File::basename.pl lately?  It defines some file name
parsing routines that have been adapted for Unix, , VMS, MacOS and DOS.

It provides:

fileparse("Long:file name:no:can.say") => ("can.say", "Long:file name:no:")
basename("Long:file name:no:can.say") => "can.say"
or
basename("Long:file name:no:can.say", ".say") => "can"
dirname("Long:file name:no:can.say") => "Long:file name:no:can.say"

If you want to parse Unix file names on a MacOS host, you can set the OS
type as well.

To extend Paul's idea, I think we want to go in several directions:

1) Extend Config.pm to identify the dynamic configuration of the host
operating system.  Currently, $Config{'osvers'} returns '7.5', which is
true for my machine and Matthias' machine, but not necessarily so for
anybody elses'.  Since Config.pm is created by the builder, a mechanism
needs to be designed for this.

2a) Extend File::basename.pl to extract other interesting properties of
filenames, and to build filenames that will work on the target.

2b) Replace File::basename.pl with an OO module that has constructors, and
parsers.

Not knowing any better, I propose that the characters slash "/", backslash
"\", colon ":", left and right square bracket "[" and "]" be treated
specially for cross-platform purposes.

Bob Dalgleish   bob.dalgleish@sasknet.sk.ca
Web Page        http://www.sasknet.com/~dalgl/