snip
>                 my $ftp = Net::FTP->new($remotehost, Debug => 10)
>                 || do {print FTPLOG "\nCannot connect to $remotehost: $!",
> mailme(); return};
snip

This is a bit off topic, but I can't look at code like this without
suggesting the following alternative:

near the top of your program say:

{
    my $olddie = $SIG{__DIE__};
    $SIG{__DIE__} = sub {
        my $error = shift;
        $olddie->{$error} if ref $olddie;
        mailme($error);
        #other error stuff here
    };
}

Then for the rest of your program you can say

my $ftp = Net::FTP->new($remotehost, Debug => 10) or
    die "Cannot connect to $remotehost: $!";

This allows you to have a complicated error procedure that is common
to anywhere you use die().  It also makes your code cleaner.  If you
want the same functionality without the program ending you can assign
your error handler to $SIG{__WARN__} and use warn() instead.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to