Re: use of uninitialized value....




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.

*********************************************************************************************************************
*********************************************************************************************************************

I appreciate the suggestion, but if there is a problem I want the progam to
email then die. So I would replace

the || do lines in the ftp section
with a routine call to? :

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


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145

.



Relevant Pages

  • Re: use of uninitialized value....
    ... > mailme(); return}; ... suggesting the following alternative: ... Prev by Date: ...
    (perl.beginners)
  • Re: PBS -- Exploring Space: the Quest for Life
    ... How does life elsewhere affect life on Earth? ... contaminated water every day? ... die from malaria. ...
    (talk.origins)
  • Re: Need a bit of advice
    ... My local NHS hospital have a nearly-full-time 'blood test ... I'm not suggesting you shoot up ... is worth a look too. ...
    (uk.people.support.depression)
  • Re: OT: Health care in other countries
    ... die of something. ... of insurance in the 1970's--income was taxed, ... My experience is that Medicare pays about 30% of "list price", ...
    (sci.electronics.design)
  • Re: Ancient sites and bodily sensations
    ... > (I'm not suggesting that's what you do.) ... >> them into existence at some level. ... >> That's not to say that the whole rainbow of existences wont be ...
    (uk.religion.pagan)