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

[MacPerl] File name bug with open.



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.

# Droplet to demonstrate file name bug.
#	Drop a file whose name ends with a space.

foreach $file (@ARGV) {
	if ($file !~ / $/) {
		print("\"$file\" doesn't end in a space!\n");
	} else {
		print("Couldn't open \"$file\".\n") unless open(FILE, $file);
		$new_name = $file;
		print ("Renamed \"$file\" ->\n \"$new_name\"\n") if
(rename($file, $new_name));
		print ("Opened \"$new_name\".\n") if open(FILE, $new_name);
	}
}



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