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

Re: [MacPerl] File name bug with open.



Brian Eaton <pewter@ibm.net> writes:
}Ran across this while working on the standalone I mentioned before - it may
}have already been reported.  Open (apparently) discards the space on the
}end of filenames, even though Mac OS allows spaces anywhere in a filename.
}The workaround is fairly simple, as rename doesn't contain the same bug.

Not a bug, a documented feature of open.  Whitespace is stripped of both
ends of the filename, so if you want it, you need to protect it.  The
easiest way to deal with it at the end of the name is open(FILE,"$file\0").
Alternatively, you can use either FileHandle or IO::File, where the open
method protects whitespace on both ends.

Start up Shuck, choose "Builtin Functions" from the Go menu, and read the
section on open().

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


--------
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693
Greenbelt, MD 20770
schinder@pjstoaster.pg.md.us


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