http://qs1969.pair.com?node_id=865833


in reply to Re^2: OS X troubleshooting help needed - parse filename & open file
in thread OS X troubleshooting help needed - parse filename & open file

You're quite right. It doesn't work as is on OS X 10.5. Here's something you might adjust to see the reason it's failing-

print -e $inputfile ? "OK, file found\n" : qq{ERROR: file "$inputfile" not found\n};
Drag and drop a file here: /Users/cow/Downloads/104937653.pdf ERROR: file "/Users/cow/Downloads/104937653.pdf " not found

You can see the extra space that dragging and dropping in the Terminal is adding. I expect this is a quirk of the OS's GUI, I don't have anything but OS X at home to try this on.

So, you're right, in this case using one of the modules would not have helped. A trim routine such as s/\s\z//; will fix this problem (though the file may have leading or trailing spaces so you'd have to be careful). The reason it took awhile and so many messages to get to this answer is your original post didn't distill the issue down to something easy to try or read. If this one had been your first post, you would have got your answer (from me or someone else) immediately.

You should still consider using a file handling package. They will ultimately save you a lot of time and catch edge cases that might matter to end users even if you think them irrelevant or karma inducing.

Replies are listed 'Best First'.
Re^4: OS X troubleshooting help needed - parse filename & open file
by elef (Friar) on Oct 17, 2010 at 20:33 UTC
    The reason it took awhile and so many messages to get to this answer is your original post didn't distill the issue down to something easy to try or read. If this one had been your first post, you would have got your answer (from me or someone else) immediately.

    Well, it did include the request to run a simple ready-made diagnostic script that cleared up the issue immediately as soon as somebody ran it.