in reply to ftp issue in perl
This does not clearly show you're trying to do, and distracts the viewer. An alternative might be:$ftp->cwd($directory) or $newerr=1; push @ERRORS, "Can't cd $!\n" if $newerr; myerr() if $newerr; $ftp->quit if $newerr;
Or, similarlyif ( !$ftp->cwd($directory) ) { push @ERRORS, "Can't cd $!\n"; myerr(); $ftp->quit; }
where ReportError is a sub that takes the error-string as an argument, and does the push, the myerr, and the quit.$ftp->cwd($directory) or ReportError( "Can't cd" );
|
|---|