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

Re: [MacPerl] problem with open()



At 06.20 -0500 1998.11.08, Andy White wrote:
>Some apps create filenames with trailing spaces - I personally don't, but I
>haven't read anywhere that MacOS dissallows this. Anyway, the following
>snippet fails to work for any such filenames:

As the documentation for open states:

# The filename that is passed to open will have leading and trailing
# whitespace deleted.  To open a file with arbitrary weird characters in
# it, it's necessary to protect any leading and trailing whitespace
# thusly:
#
# 		    $file =~ s#^(\s)#./$1#;
# 		    open(FOO, "< $file\0");

... but now that I look at the solution, I don't see how it would help with
the leading whitespace in MacPerl.  Just make sure that there is no leading
whitespace.  So for relative paths, put a ':' in front if it is not already
there.  For absolute paths where the volume name has whitespace in front, I
think you are screwed.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

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