开发者

File::Util make_dir unwanted output

when using this sub, if I pass a directory with bad characters it spits its output to the console like this:

PROCESS TERMINATED DUE TO ERRORS

File::Util can't use this string for �the name of a directory�.
   �ddd??---?d�
It contains illegal characters.

Illegal characters are:
   \   (backslash)
   /   (forward slash)
   :   (colon)
   |   (pipe)
   *   (asterisk)
   ?   (question mark)
   "   (double quote)
   <   (less than)
   >   (greater than)
   \t  (tab)
   \ck (vertical tabulator)
   \r  (newline CR)
   \n  (newline LF)

Origin:     This is a human error.
Solution:   A human must remove the illegal characters from this string.

ARG   _pak = File::Util
ARG   purpose = the name of a directory
ARG   string = ddd??---?d

1. File::Util::_throw
    -called at line (1343) of blib/lib/File/Util.pm (autosplit into blib/lib/auto/File/Util/make_dir.al)
       -was call开发者_如何学Goed with args
       -was not called to evaluate anything


2. File::Util::make_dir
    -called at line (35) of importdatafiles.pl
       -was called with args
       -was not called to evaluate anything


3. (eval)
    -called at line (35) of importdatafiles.pl
       -was called without args
       -was not called to evaluate anything

How to suppress this output (I just want to print "Bad" without all this detailed info)


use File::Path qw/mkpath/? I don't know whether it runs under windows though, but it's worth a try.


"Just suppressing the output" probably can be done through eval/die construct. Like this:

eval { make_dir (...) };
if ($@) { die "nice short error message" };

However, that long error message is still stunning me. It was so insulting that I mistaken it for a Windows CLI utility output, as you can see :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜