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

Re: [MacPerl] How do you... solve the pathname problem?




Vicki Brown wrote:

> First, please, let's not re-open the discussion of whether MacPerl should
> understand Unix-style pathnames by default!  Matthias would be very upset
> with me if I were responsible for that while he's a guest here in my little
> part of 3D space :-)
> 
> But... we all know that Mac OS and Unix differ in how they use pathnames.
> How do you solve the problem?  How do you write portable code? (or don't
> you try?)

I think the Kenneth Albanowski's File::Spec module now comes standard 
with perl (I just checked 5.005_02 and it's there alright).

But to merely go from UNIX to Mac style it is still pretty simple to 
write some regex[e|p]s on the fly:

  $mac_spce = $unix_spec;
  $mac_spce =~ s#\/#:#g;

plus appropriate trimming of leading stuff to account for unix filessystem 
vs. Mac volume name differences.  Some the scripts that we run here also employ 
a lib that sets a $path_separator variable - but I cannot recommend that 
approach since it can wind up being so poorly documented compared to standard 
modules like File::Spec::Mac.

[off topic]: BTW I just spent a good amount of time trying to scare up a tar 
program for the Mac and only found a binary (and MrC?) at the UMich archive 
that suited my needs, although doing the <LF>-><CR> translation appeared to 
be an all files or none proposition.  I am wondering where might I have 
missed a newer version that employs binary vs text heuristic(s) to extract 
text and bin files from an archive (something rumoured to exist out there ;-)?
Since most of CPAN is .tar.gz I think that the MacPerl FAQ ought to mention 
where to obtain the latest MacGzip and tar programs.  Sorry for the 
cluelessness but I had to first find umich (It is not mentioned at apple or 
ptf that I saw and I wound up using yahoo) then wade through a bunch of 
Star Trek program listings to find 'tar'.


Peter Prymmer



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch