Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: filename with question mark

by kcott (Abbot)
on Oct 03, 2012 at 17:52 UTC ( #997109=note: print w/ replies, xml ) Need Help??


in reply to filename with question mark

G'day Brian,

Welcome to the monastery.

I also have Mac OS X Lion (10.7.5); I'm running Perl v5.14.2.

File::Find and $File::Find::name work for me:

$ ls -l abc? -rw-r--r-- 1 ken staff 0 4 Oct 03:13 abc? $ perl -Mstrict -Mwarnings -E ' use File::Find; sub wanted { /\?$/ && say $File::Find::name } find(\&wanted, q{.}); ' ./abc?

Filename completion also works. If I type ls -l abc<TAB><RETURN>, I get:

$ ls -l abc\? -rw-r--r-- 1 ken staff 0 4 Oct 03:42 abc?

Please post enough of file_collector.pl to reproduce your problem.

-- Ken


Comment on Re: filename with question mark
Select or Download Code
Re^2: filename with question mark
by bdugay (Novice) on Oct 03, 2012 at 21:37 UTC
    Hi Ken, thanks for testing. The last character of your file appears to be different than mine. I don't think providing my code at this point is relevant. Going by Anonymous' comment, I'll investigate how to handle file with what appears to be a ^M (\r) at the end of a filename. -Brian

      I'll investigate how to handle file with what appears to be a ^M (\r) at the end of a filename. -Brian

      Well, it really shouldn't need special handling, other than making sure when you warn/die... the filename is escaped, because \r among other chars doesn't show up well in console :)( Basic debugging checklist )

      open should just open the file, so first thing to try is feeding it proper Dumpered filename -- if that works, you know what to work on next, which is

      how the filename gets to your program, if its readdir, it should work, if its @ARGV or something else, you might need to decode utf8 ... see utf8, how to unicode filenames?, how to make a filename in unicode characters

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://997109]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (10)
As of 2014-09-23 22:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (241 votes), past polls