[ABE.pm] automating FTP in Perl

Faber Fedor faber at linuxnj.com
Thu Dec 9 15:54:50 CST 2004


What is The Proper Way to do that?

I thought it was to use Expect.pm, but I can't figure out how to get the
$%^ errors from Expect.pm.  I do this in my code:

    my ($matched_pattern_position, $error,
        $successfully_matching_string, $before_match, $after_match) =
        $exp->expect($timeout,"Transfer complete.");

    if ( defined($exp->error()) ) {
        log_message($tag,"before = $exp->before() \n");
        log_message($tag,"error = $error\n");
        log_message($tag,"exp_error = $exp->exp_error()\n");
        log_message($tag, "FTP Error: $exp->error()");
        exit;
    }

And whether I have errors or not (I successfully download the file or
the file doesn't exist), I always get this:

Dec  9 17:00:40 nycaserver1 forddaily: before = Expect=GLOB(0x862fcc8)->before()
Dec  9 17:00:40 nycaserver1 forddaily: error = 1:TIMEOUT
Dec  9 17:00:40 nycaserver1 forddaily: exp_error = Expect=GLOB(0x862fcc8)->exp_error()
Dec  9 17:00:40 nycaserver1 forddaily: FTP Error: Expect=GLOB(0x862fcc8)->error()



If you guys need to automate and test an FTP download in Perl, what do
you use?

-- 
 
Regards,
 
Faber                     

Linux New Jersey: Open Source Solutions for New Jersey
http://www.linuxnj.com





More information about the ABE-pm mailing list