$sftp->mkdir("/$server_dir") or warn "mkdir1 failed $!\n"; $sftp->mkdir("/$image_dir") or warn "mkdir2 failed $!\n";Now for the questions. I'm looking for a way to make the failure of mkdir more informative for the case that the directory already exists. I keep the mkdir line so that it will work the first time it is used. Every subsequent time, it fails, and $! is stone silent. This module is on github at html7.pm.
The mkdir you are using here is not the build-in mkdir. The latter sets $! on error (and perhaps $^E). The former one is a method of some SFTP object that could do the same, but probably has a different error mechanism.
The code on github currently uses Net::SFTP::Foreign, and as already explained, it requires to check $sftp->error() instead of $!. You could also get rid of manual error checking by using autodie mode, much like in DBI.
Alexander
In reply to Re: using online translation engines with perl
by afoken
in thread using online translation engines with perl
by Aldebaran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |