我使用Net :: FTP將文件傳輸到大型機,並且正在測試失敗情況。來自Perl Net :: FTP的錯誤原因
我的代碼基本上是大致如下:
my $ftp = Net::FTP->new ("mainframe.com", Timeout => 20);
if (! $ftp) {
logMessage ("Could not connect to host: $!");
return;
}
if (! $ftp->login ("paxdiablo", "demigodemporeroftheuniverse")) {
logMessage ("Could not log in to host: $!");
$ftp->quit();
return;
}
if (! $ftp->put ("myfile.txt", "'CANT.WRITE.TO.THIS'")) {
logMessage ("Could not put file: $!");
$ftp->quit();
return;
}
我知道我不能創建數據集CANT.WRITE.TO.THIS
因爲我沒有必要的權限,但是,當我嘗試,唯一的我看到的消息是:
Could not put file:
$!
沒有跡象表明問題是什麼。我看着在Net::FTP
doco和所有它說的是:
put (LOCAL_FILE [, REMOTE_FILE ])
Put a file on the remote server. LOCAL_FILE may be a name or a filehandle. If LOCAL_FILE is a filehandle then REMOTE_FILE must be specified. If REMOTE_FILE is not specified then the file will be stored in the current directory with the same leafname as LOCAL_FILE.
Returns REMOTE_FILE or the generated remote filename if REMOTE_FILE is not given.
我也找不到任何有關於檢索特定錯誤(如$ftp->getLastError()
什麼類似)。
我該如何向用戶註明爲什麼的傳輸失敗?
在較早的迭代中,我採取了放置文件,然後再次獲取並在本地檢查內容。我真的寧願不是不得不再次對人們造成這樣的代碼。
你可以通過FTP服務器提交一個小的工作,試圖創建數據集CANT.WRITE.TO.THIS。然後解析JESLOG中的RACF或ACF2消息,指出更具體的錯誤。 – 2012-01-30 03:53:11