in reply to Perl stricter than my OS regarding file/dir names
'perldoc perldiag'
Unsuccessful %s on filename containing newlineIf you grep the perl source, you'll find these tests(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.
######## # 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.
So to disable that particular warning, through warnings, you simply write######## # 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.
perllexwarn lists newline among others (though it doesn't really explain what warnings it blocks).no warnings 'newline'; next if -d "$dir/$current_filename";
|
---|
In Section
Seekers of Perl Wisdom