in reply to Re: NET::FTP::Recursive
in thread NET::FTP::Recursive

kwaping is right. from the CPAN docs:
rget ( [ParseSub =>\&yoursub] [,FlattenTree => 1] [,RemoveRemoteFiles +=> 1] )
If you want the map() to be used in parsing, i believe you need to pass it as a subroutine reference.

__________
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
- Terry Pratchett

Replies are listed 'Best First'.
Re^3: NET::FTP::Recursive
by Anonymous Monk on Jan 24, 2006 at 16:24 UTC
    So if I try the following ( $yesterdays_date(variable) being a directory inside the remote_path) is correct? I don't wish to remove the files just copy...
    my $output = $ftp->rget([ParseSub =>\&$yesterdays_date]);
      If you're using version 1.6 or higher of Net::FTP::Recursive, this might better suit your needs:
      my $regex = qr/$yesterdays_date/; my $output = $ftp->rget(MatchDirs => $regex);
      Upon further inspection of the documentation, it appears the module's author forgot or otherwise neglected to document the usage of ParseSub.

      My guess is to do something like this:
      my $sub = sub { return shift =~ /$yesterdays_date/ }; my $output = $ftp->rget(ParseSub => $sub);
        I implemented your suggestion and the $sub call comes back undefined. The $yesterday_date is a date ...> 20060122.
Re^3: NET::FTP::Recursive
by Anonymous Monk on Jan 24, 2006 at 16:48 UTC
    I think what I am confused about is the \&yoursub call. Do I replace this sytex with my reference to the directory?