Wiggins d Anconia <[EMAIL PROTECTED]> wrote:
> 
> 
> > Hi,
> > 
> > Much to my surprise, when I run this code, it never returns 0 if it
> could not
> > carry out the operation.
> > 
> >   $rc = $f->site("chmod 666 $remoteFile") 
> >       or die "ftp: Could not change permissions: $!\n";
> > 
> > It seems to return a 2 on success, and a 5 if it could not access the
> file
> > because of a different owner.
> > 
> > My question is, what return code can I rely on?  I need to be sure the
> > permissions were set to '666'.
> > 
> > Any suggestions?  This is a emergency "quick fix".
> > 
> > Thanks in advance....
> 
> From the docs:
> 
> "Returns most significant digit of the response code."
> 
> The response code is part of the FTP specification, response codes in
> the 200's are successes and responses in the 500's are failures, so it
> should be sufficient to check for a 2 and have that be success, a 5
> makes failure and anything else is undefined.  By looking at the 2
> lesser significant digits normally a failure cause can be determined,
> but with 'site' that is system dependent (at least I think).

This makes sense (now).  Silly me, I thought non-zero was success.  Using a
truncated number from the RFC was definitely a mystery.  I wish these
packages followed a stricter standard.

This helped tremendously, and I've resorted to using something like 

  $perm = substr(sprintf("%s",  $f->dir($remoteFile)), 1, 9);

  die "Bad permissions\n" unless ($perm =~ /rw-rw-rw-/);


Thanks again! =)

-Jeff


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to