[Net::FTP] can't open data connection
Bonjour à tous et à toutes...
Voilà, je dois réaliser un script Perl d'alimentation d'une base de donnée à partir de fichiers récupérés par FTP en mode passif obligatoirement. Pour l'instant, je découvre Perl, alors ne soyez pas trop regardants sur le code ;)
Je vous mets le script :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#!/opt/csw/bin/perl
use strict;
use Net::FTP;
my $ftpserver="XXX.XXX.XXX.XXX";
my $ftpuser="XXXXXXX";
my $ftppsswd='XXXXXXX';
my $ftpdirectory="/XXX";
print("Connecting to ftp server ...\n");
my $ftp = Net::FTP->new($ftpserver,
Debug => 0, Passive =>1, Timeout=>10 ) or die("Cannot connect to some.host.name: $@");
print("Connected to server ...\n");
print("Login to ftp server ...\n");
$ftp->login($ftpuser,$ftppsswd) or die "Cannot login ", $ftp->message;
print("Logged to ftp server ...\n");
print("Changing directory ...\n");
$ftp->cwd($ftpdirectory) or die "Cannot change working directory ", $ftp->message;
print("Listing files ...\n");
my @list=$ftp->ls() or die "Cannot listing files in directory ! ",$ftp->message;
print("Closing connection...");
$ftp->quit();
print("Connection closed ...\n");
for (@list)
{
print($_."\n");
} |
Le souci est que j'obtiens une erreur 425 "Can't open data connection" lors de la tentative de ftp->ls(). Ca me fait la même chose avec ftp->dir.
Cela inspire-t-il les brillants cerveaux perliens qui me lisent ?
Merci à vous