2010-12-04 83 views
1

使用此子的時候,如果我通過與壞字符的目錄中它吐出其輸出到控制檯這樣的:文件::的Util make_dir不需要輸出

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 called 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 

如何抑制這種輸出(我只是想打印「壞」沒有所有這些詳細信息)

回答

2

使用File::Path qw/mkpath /?我不知道它是否在Windows下運行,但它是值得一試。

+0

謝謝,但我敢肯定有一種方法來抑制我以上提到的輸出。 – snoofkin 2010-12-04 17:12:02

0

「只是抑制輸出」可能可以通過eval/die結構完成。像這樣:

eval { make_dir (...) }; 
if ([email protected]) { die "nice short error message" }; 

但是,那長長的錯誤信息仍令我驚歎。這是如此侮辱,我誤以爲它的Windows CLI實用程序輸出,你可以看到:)