Dear monks, I have a two part program, which utilises LWP::UserAgent / HTTP::Request to download files from the 'net, and Net::FTP to upload those files. The source machine is my MacBook Pro (Leopard) and the destination machine is a Windows 2003 FTP server. The following is a looksee at the code I am attempting to use for my file transfer:
# Pattern match all .ipup files in local directory my @files = glob("*.ipup"); # Declare $ftp my $ftp; $ftp = Net::FTP->new($ulservername, Debug => 1, Timeout => 120, Hash = +> \*STDERR) or die "Cannot connect the FTP server called $ulservernam +e.\n"; $ftp->login($username,$password) or die "Authentication on $ulserverna +me failed\n"; $ftp->binary() or die "Could not set BINARY command on $ulservername\n +"; $ftp->cwd($rdirectory) or die "Could change working directory on $ulse +rvername\n"; # Execute the FTP transfer foreach my $file (@files) { print "Copying $file to FTP server...\n"; $ftp->pasv() or die "Could not set PASV command on $ulservername\n" +; $ftp->put($file, $file) or die "Could not transfer $file to FTP ser +ver: $!\n"; } # Send quit to FTP server $ftp->quit() or die "Could not quit the FTP session. Que sera sera\n";
The thing that kills me is that time after time, the $ftp->put() operation times out. I can use FTP from the shell and mput my data to the FTP server without any problems. What have I done wrong? Why does this simple code torment me so? I also checked out my glob() by printing the output to screen, and that looks okay. The foreach() also shows that its uploading one file at a time. As an aside, file size ranges between 170Mb and 180Mb per file. Your assistance would be greatly appreciated.

Update: Resolved. If eedjit over here had removed the second $file from the $ftp->put() call, the script would have worked ages ago.

In reply to Net::FTP insanity by NoSignal

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.