in reply to NET::FTP::Recursive

The syntax you're using for rget doesn't look anything like what the Net::FTP::Recursive docs describe. What are you trying to accomplish there?

Also, what is $extract? It's not defined elsewhere in your posted code snippet.

Replies are listed 'Best First'.
Re^2: NET::FTP::Recursive
by EvanK (Chaplain) on Jan 24, 2006 at 16:09 UTC
    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

      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 think what I am confused about is the \&yoursub call. Do I replace this sytex with my reference to the directory?
Re^2: NET::FTP::Recursive
by Anonymous Monk on Jan 24, 2006 at 16:15 UTC
    Hello Sorry, the snippet it did not include all the variables. The $extract variable is a directory inside the remote_path i.e
    /tng/logs/KM - > The KM being the $extract. The idea is to throw a different directory through a subroutine...
    The objective here is to simply login to the ftp site and copy a specific directory tree to a local storage network.
    The snippet was copied from the authors examples..
    Thank you for your time... your help is greatly appreciated.