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

Re: [MacPerl] Error opening file w/trailing spaces in name



In article <14000.48379.97202.279482@macupo>, Christian Brechbuehler <brech@vision.ee.ethz.ch> writes:
> Ouch!  However later it goes on (page 194):
> ::    In order to open a file with arbitrary weird characters in it,
> ::    it's necessary to protect any leading and trailing whitespace,
> ::    like this:
> ::    
> ::        $file =~ s#^\s#./$&#;
> ::        open FOO, "< $file\0";
> ::    
> ::    But we've never actually seen anyone use that in a script...

Another alternative is to use sysopen().

> The second line relies on the fact that Perl can handle NULs (\0)
> embedded in a string, wheras in C it signals the end of any string.
> (Under Unix, filenames consist of characters that
> **    ... may be selected from the set of all character  values
> **    excluding  \0  (null)  and the ASCII code for / (slash).
> -- intro(2))

> But can a NUL be in a Mac filename?

Yes.

>Will MacPerl support it?

No. You've got to draw the line somewhere :-(

Matthias

-- 
Matthias Neeracher   <neeri@iis.ee.ethz.ch>   http://www.iis.ee.ethz.ch/~neeri
   "I'm set free to find a new illusion" -- Velvet Underground

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