in reply to FTP automation

Hmm ... I don't quite understand what the problem is since your manual ftp session is different than your scripted session. In the manual, you just list the contents of the remote machine. The numbered lines are the control channel and the Net::FTP module hides that from you (you shouldn't need to worry about it). See RFC959 for more info on the inner workings of ftp (control -vs- data channels).

In your scripted ftp session you state you're getting a "closed socket" error which is what I would expect given initial statement The equipment in question automatically reboots itself upon receipt of the new phonebook. So how would I handle the error? I wouldn't. I would just check the return value of the put and if okay, just exit:

$FTP->put( $opb ) || die "An error occurred with put"; print "All is well ... exiting\n";

-derby

Replies are listed 'Best First'.
Re: Re: FTP automation
by dataDrone (Acolyte) on Jun 27, 2003 at 21:38 UTC
    When FTP'ing... I always PUT the file as a temporary name, then at least do a DIR to check that the entire file got there (byte count the same using bin mode transfer, no clue what you'd do if not and didn't want to GET the file back) then I rename the file to the desired name, thus preventing anything looking for the file from acting on a partial file. should also help out here.
Re: Re: FTP automation
by TStanley (Canon) on Jun 30, 2003 at 13:49 UTC
    Unfortunately, the equipment is not rebooting itself when it gets the phonebook (It is setting on a shelf at eye level, and the boot light doesn't come on). I can attempt to send an ls command to it, but I get the same error message as above.

    TStanley
    --------
      stange indeed. Have you tried setting the debug flag to see if anything odd pops up (need for passive mode? timeout? etc?)

      my $FTP=Net::FTP->new($mvp, Timeout=>20, Debug => 1);

      -derby

        Setting the debug in my above test code shows the following:
        Net::FTP: Net::FTP(2.65) Net::FTP: Exporter(5.566) Net::FTP: Net::Cmd(2.21) Net::FTP: IO::Socket::INET(1.26) Net::FTP: IO::Socket(1.27) Net::FTP: IO::Handle(1.21) Net::FTP=GLOB(0x15de3b4)<<< 220 Service ready Net::FTP=GLOB(0x15de3b4)>>> user mvpadmin Net::FTP=GLOB(0x15de3b4)<<< 500 Unsupported command Connected to 128.1.198.22 Net::FTP=GLOB(0x15de3b4)>>> TYPE I Net::FTP: Unexpected EOF on command channel at ftptest.pl line 17 getsockname() on closed socket GEN0 at D:/Perl/lib/IO/Socket.pm line 1 +92.

        TStanley
        --------