Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: net ftp recursive - rls and rdir

by Lotus1 (Vicar)
on Sep 07, 2012 at 13:01 UTC ( [id://992308]=note: print w/replies, xml ) Need Help??


in reply to net ftp recursive - rls and rdir

I don't think the filehandle you are passing to rls() is valid. The cpan page for the FileHandle module provides examples that show you have to provide a filename for it to open.

use FileHandle; $fh = FileHandle->new; if ($fh->open("< file")) { print <$fh>; $fh->close; } $fh = FileHandle->new("> FOO"); if (defined $fh) { print $fh "bar\n"; $fh->close; }

You need a filehandle for output so use the second version.

Update: from the documentation for Net::FTP::Recursive:

All of the methods should return false ('') if they are successful, and a true value if unsuccessful.

The rls method will write the filenames into the filehandle. The code you showed expects the files to be returned as an array.

my @files = $f->rls(Filehandle => $fh) or die "??";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://992308]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-19 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found