http://qs321.pair.com?node_id=266294

k2 has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,
I'm trying to use the module Net::FTP::Recursive to get an entire catalog-structure from an FTP-server.
I used the rget-script that came along with the module and it works fine, when I connect to a Unix/Linux FTP...
BUT (there's allways a but) it does NOT work when I connect to a Novell FTP-server.
So I had a look at the script and came across this line:
(se below for the entire script)
$ftp->rget( map{($_, 1)} @ARGV);
The problem is that I can't figure out what the digit 1 does...
I think/hope/guess that the 1 refers to the digit 1 that shows that it's is a
file and not a directory when I do a dir on the Unix/Linux FTP-server.
If so I know that the Novell FTP-server has a "-" to indicate that it's a file and not a directory,
but I can't seem to get the script to work if I change the "1" to a "-".
I havde read the Map: The Basicsand the Complex Sorting
but neither of them has made me see the light ;-)
They talk about BLOCK's but ($_, 1) has me somewhat confused...

So now I hope that someone in the Monastary has the time to shed some light on my problem...

TIA
k2
----------------> CODE <---------------- #!/usr/bin/perl use Net::FTP::Recursive; #################################################################### # will assume just a few args, as well as validity. #################################################################### usage() unless @ARGV >= 5; $host = shift; $username = shift; $passwd = shift; $remote_path = shift; #where to grab from $local_path = shift; #where to put dir structure on local box. chdir $local_path or die "could not change dir to $local_path!"; $ftp = Net::FTP::Recursive->new($host, Debug => 1); $ftp->login($username, $passwd) or die "Could not log in!"; $ftp->binary(); $ftp->cwd($remote_path); $ftp->rget( map{($_, 1)} @ARGV); $ftp->quit; sub usage { my($name) = $0; $name =~ s#.*/##; print STDERR "Usage: $name <host> <username> <passwd> <remote_path> +<local_path>\n"; exit; }