Chas Owens wrote:

> Be careful, this is Net::SFTP::Foreign, not Net::SFTP.
> They are very similar, but there are differences.

Well, I should know, as I am the module author ;-)


> For instance the ls method
> returns an arrayref, not a list in Net::SFTP::Foreign.  This means
> your code should be

oops, you are right!!!

> my @files = @{
>     $sftp->ls($remote_dir, wanted => sub { S_ISREG($_[1]->{a}->perm)})
> };

or better:

  my $files = $sftp->ls(...)
    or die "unable to list remote directory: " . $sftp->error;

  print "$_->{filename}\n" for @$files;

after all, error checking is the only reason for "ls" returning an
array ref instead of a list.

Cheers,

 - Salva


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


Reply via email to