For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > August 2005 > error message with net::FTP









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author error message with net::FTP
Laurent Coudeur

2005-07-28, 9:59 pm

Hi there,

I am having some trouble with net::FTP module
I get this error message
Timeout at /usr/lib/perl5/5.8/Net/FTP.pm line 1001

the script list directories in a path
then loops and list subdirectories
I can connect and list files but as I try to ls into final sub-directory
it hangs I get into the directory but cannot list

foreach (@list){
$ftp->cwd();
$ftp->cwd("$_");
my @filelist=$ftp->ls($_) or print LOG "cannot get in project folder
$_";
foreach (@filelist){
print LOG "$_";
$ftp->cwd();
$ftp->cwd("$_") or print LOG "cannot get in date folder
$_";
print LOG "\n";
print LOG "current folder ";
print LOG $ftp->pwd();
print LOG "\n";
my @today=$ftp->ls("$_") or print LOG "cannot read in
date folder $_\n";
}
print LOG "\n";
}

my log contains this:
/[base]/[subdir]
/[base]/[subdir]/0102/050601
current folder /[base]/[subdir]/0102/050601

timeout is at prompt

any ideas / Or stuff so obvious I cannot see it

Laurent Coudeur
353 1 212 3181


Owen

2005-07-28, 9:59 pm

On Thu, 28 Jul 2005 10:17:35 -0400
"Laurent Coudeur" <Laurent_Coudeur@lionbridge.com> wrote:

> I am having some trouble with net::FTP module
> I get this error message
> Timeout at /usr/lib/perl5/5.8/Net/FTP.pm line 1001
>
> the script list directories in a path
> then loops and list subdirectories
> I can connect and list files but as I try to ls into final sub-directory
> it hangs I get into the directory but cannot list
>
> foreach (@list){
> $ftp->cwd();
> $ftp->cwd("$_");
> my @filelist=$ftp->ls($_) or print LOG "cannot get in project folder
> $_";



I wonder if your $_ is being clobbered, what happens if you try

foreach my $item(@list){
and replace all instances of $_ with $item





Owen
Laurent Coudeur

2005-07-29, 5:01 pm

-----Original Message-----
From: Owen [mailto:rcook@pcug.org.au]=20
Sent: 29 July 2005 00:07
To: beginners@perl.org
Subject: Re: error message with net::FTP

On Thu, 28 Jul 2005 10:17:35 -0400
"Laurent Coudeur" <Laurent_Coudeur@lionbridge.com> wrote:

> I am having some trouble with net::FTP module I get this error message


> Timeout at /usr/lib/perl5/5.8/Net/FTP.pm line 1001
> =20
> the script list directories in a path
> then loops and list subdirectories
> I can connect and list files but as I try to ls into final=20
> sub-directory it hangs I get into the directory but cannot list
> =20
> foreach (@list){
> $ftp->cwd();
> $ftp->cwd("$_");
> my @filelist=3D$ftp->ls($_) or print LOG "cannot get in project=20
> folder $_";



I wonder if your $_ is being clobbered, what happens if you try

foreach my $item(@list){
and replace all instances of $_ with $item




Thanks Owen I did that but it still does the same=20
I have copied the script on a linux box Here (using windows most of the
time)
The script is actually fine (I added your suggestion to be safe but same
problems still occur).
It times out only in windows and only in blank directories. In linux I
get the or message in logs

Does anybody knows of a workaround short of adding a blank file in all
directories?

I have to run this on a windows box (unfortunatly)

Laurent

Tom Allison

2005-08-02, 4:59 pm

Laurent Coudeur wrote:
> -----Original Message-----
> From: Owen [mailto:rcook@pcug.org.au]
> Sent: 29 July 2005 00:07
> To: beginners@perl.org
> Subject: Re: error message with net::FTP
>
> On Thu, 28 Jul 2005 10:17:35 -0400
> "Laurent Coudeur" <Laurent_Coudeur@lionbridge.com> wrote:
>
>
>
>
>
>
>
> I wonder if your $_ is being clobbered, what happens if you try
>
> foreach my $item(@list){
> and replace all instances of $_ with $item
>
>
>
>
> Thanks Owen I did that but it still does the same
> I have copied the script on a linux box Here (using windows most of the
> time)
> The script is actually fine (I added your suggestion to be safe but same
> problems still occur).
> It times out only in windows and only in blank directories. In linux I
> get the or message in logs
>
> Does anybody knows of a workaround short of adding a blank file in all
> directories?
>
> I have to run this on a windows box (unfortunatly)
>
> Laurent
>
>


So on the empty directories you get something like this:

my @filelist=$ftp->ls($_)
returns undef?

If so, you can test for that and 'next'

my @filelist=$ftp->ls($_)
next unless @filelist; # or something, it's late here.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com