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

Re: [MacPerl] Path-separator (was: Newlines)



At 00.47 10/13/97, Terje Bless wrote:
>What if the filename was "File)"?

Including or excluding the " marks?

If a file has " in the names, then you can always use qq or q and the quote delimiter of your choice.

For a folder named: PowerPudgeII:Desktop Folder:"File)"

#!perl -wl
opendir(D,q{PowerPudgeII:Desktop Folder:"File)"});
foreach(readdir(D)){print}

Works fine.  But to make '/' the deafault separator makes it so that you MUST escape a certain character just to process a file with a '/' in the name, and there would be no way around it.  Also, that would require an extra step in the tex processing; before it went to the double-quotish interpolation, it would have to translate / to :.  Ugh.

I personally think we should resign to the fact that different operating systems are different, and there is no easy way around it.

Q: Anyone know how other cross-platform scripting languages take care of it (separators and newlines)?

Anyway, here is what Matthias has said in the past.

#============================================
19 Aug 1996
 - Scott's remark about the lack of a path handling library is absolutely
   correct, and noted as such. As far as I know, Kenneth Albanowski and/or
   Charles Bailey are working on such a library.
 - His point about line terminators in the parser was well taken. I've 
   inspected the perl sources to see what it would take to make the perl
   parser recognize all end of line styles (CR, LF, CRLF), but with the 
   current I/O architecture, that's not possible in an efficient way.
   Perl will soon switch to an sfio based architecture, and then, this project
   is worth another look.
 - Intuiting the OS from directory tests, as Daniel suggests, is somewhat too
   risky (one day you might meet a freak Mac with a directory named "/") and 
   not necessary anyway: Just use the $^O variable. 
#============================================
07 May 1997
I hope we can start winding down the CR/LF debate again. It tends to flare up
every year and drag on and on. The parameters of the debate have not changed
since 1991:

 - I will not implement any proposal that requires people to change their code
   to get Mac newlines when writing Mac files.
 - I will not interfere with anyone implementing what he thinks is the right
   thing to do in MacPerl.

In private mail this morning, I got a proposal to implement '/' as a path
separator, do don't even *think* of bringing *that* proposal up again. It would
require significant climate changes in unpopular residential areas of the
afterlife before I implement that proposal, but I won't interfere with anyone
else implementing it.

haz1@nwu.edu (Bill Hazelrig) writes:
>Maybe what's needed is an I/O streams module which replaces the standard
>I/O semantics (as "use integer" does the standard arithmetic semantics).
>Give fopen() an extra parameter when the module is used-- a reference to a
>variable containing the line-break string to use; when opening a file for
>input, fopen() would set this variable (via the reference passed in the
>call to fopen).  Then, calls to <FILEHANDLE> and print FILEHANDLE ...
>could implicitly do s/$$LineBreakRef/\n/g and s/\n/$$LineBreakRef/g,
>respectively.

This is actually a proposal with some chances of succeeding. While I haven't
worked out all the details yet, perl5.004 optionally supports sfio instead of
stdio, and I intend to switch MacPerl over to sfio (I've had a Mac sfio port
available for some time). sfio supports the pushing of "filter functions" onto
standard I/O streams, and I vaguely remember that Perl supports, or could be
made to support, this functionality. If that works out, it will be easy to
support LFs, runes, barcode, or EBCDIC for a stream.
#============================================

Matthias, any new words?

--
Chris Nandor             pudge@pobox.com             http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==            MacPerl:  Programming for the Rest of Us            ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#



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