in reply to Memory leak!
The first thing I notice is that the code you posted will not even compile. You have a missing close brace:
sub ftpFileGet { my $workingDir = $globals[2]{'workingDir'}; my $select = Net::Netrc->lookup($host, $userAcct); my $pass = $select->password(); my $ftp = Net::FTP->new($host); $ftp->login($userAcct, $pass); $ftp->pasv; $ftp->binary; chdir($workingDir); foreach my $fileToGet (@matches) { $ftp->cwd("$remoteDir"); my $remoteFileSize = $ftp->size($fileToGet); my $localFileName = "$fileToGet"."$globals[1]{'transfer'}"; my $ftpReturnVar = $ftp->get($fileToGet, $localFileName); next if ! defined $ftpReturnVar; my $localFileSize = (stat "$workingDir/$localFileName")[7]; if ($remoteFileSize == $localFileSize) { push (@filesToRetrv, $ftpReturnVar); ## <<<<<<<<<<<<<<<<<<<<<<< Guess what is missing here!! } $ftp->quit(); return @filesToMove; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Memory leak!
by joeymac (Acolyte) on Dec 12, 2011 at 19:20 UTC |