> > What is unexpected about this?  Your error is being caught, and the
> > first line is just a warning, and a pretty useful one at that.
> 
> 
> >From the Net::FTP documentation:
> 
> 
> get ( REMOTE_FILE [, LOCAL_FILE [, WHERE]] )
> 
> Get "REMOTE_FILE" from the server and store locally. "LOCAL_FILE" may be a
> filename or a filehandle. If not specified, the file will be stored in the
> current directory with the same leafname as the remote file.
> If "WHERE" is given then the first "WHERE" bytes of the file will not be
> transfered, and the remaining bytes will be appended to the local file
if it
> already exists.
> Returns "LOCAL_FILE", or the generated local file name if "LOCAL_FILE" is
> not given. If an error was encountered undef is returned.
> 
> 
> So the expected behaviour would be return undef and put the warning in
> $ftp->message as the other functions do.
>

It is returning 'undef' that is why your script is calling the 'or die',
the warning is a client side problem, aka non-existence of a local file,
which is why it is a warning rather than returned in $ftp->message which
contains the return value from the server side, in this case a success
because the file does exist, is readable, blah blah. It only fails when
it can't store the local file, which the server doesn't know (or care)
about.   Because of this the client has to handle the problem (and in
this case should handle it apriori, hence the check for the
pre-existence of the destination).  It makes sense as a warning because
it alerts the developer that they haven't done as complete of a job
error checking as they should.
 
> 
> > What is the actual behaviour you are after?  What are you trying to
> > prevent?  Why wouldn't you want to check for the existence of the
> > destination directory, considering for completeness you should be
> > checking for it?
> 
> 
> I initially wanted to prevent my script to start creating a bunch of
> directories if someone f*uck up the configuration file.
> But as you suggested, I should be checking for existance rather than just
> create the dir ;)
> 

Yeh, and that is simple enough anyways.

> 
> > For efficiency's sake you shouldn't even bother connecting if the
> > destination doesn't exist, at least in the snippet you have shown us.
> 
> 
> Yeah, it was a quick cut & paste "test script".
> 
> Thanks!!
>

No problem,

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to