Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Perl stricter than my OS regarding file/dir names

by PodMaster (Abbot)
on Feb 15, 2006 at 22:41 UTC ( [id://530557]=note: print w/replies, xml ) Need Help??


in reply to Perl stricter than my OS regarding file/dir names

'perldoc perldiag'
Unsuccessful %s on filename containing newline

(W newline) A file operation was attempted on a filename, and that operation failed, PROBABLY because the filename contained a newline, PROBABLY because you forgot to chomp() it off. See chomp in the perlfunc manpage.

If you grep the perl source, you'll find these tests
######## # doio.c [Perl_my_stat Perl_my_lstat] use warnings 'io' ; stat "ab\ncd"; lstat "ab\ncd"; no warnings 'io' ; stat "ab\ncd"; lstat "ab\ncd"; EXPECT Unsuccessful stat on filename containing newline at - line 3. Unsuccessful stat on filename containing newline at - line 4.
######## # pp_sys.c [pp_stat] use warnings 'newline' ; stat "abc\ndef"; no warnings 'newline' ; stat "abc\ndef"; EXPECT Unsuccessful stat on filename containing newline at - line 3.
So to disable that particular warning, through warnings, you simply write
no warnings 'newline'; next if -d "$dir/$current_filename";
perllexwarn lists newline among others (though it doesn't really explain what warnings it blocks).

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-26 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found