On 1/27/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
snip
> Thanks Jay for the hopefully final wrap up to the uninteded long email
> thread.  This was a good thing however b/c
> I learned something new in this wonderful thing called Perl.
> I agree and it make sense to use   $SIG{__DIE__} for obvious reasons.
> But in my test code I am getting "Useless use of hash element in void
> context at line 30."
> which is the line that has the   $overide->{$error}.  But when I comment
> out the mailme call I do not get this warning.
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
>
>        sub mailme {
>
>                 my $sub     =  shift;

why aren't you using $sub (which I would rename $message or $error) in
the body of the message?

>                 my $msg     =  MIME::Lite->new(
>                 From        => 'pshrapprd <[EMAIL PROTECTED]>',
>                 To          => 'Derek Smith <[EMAIL PROTECTED]>',
>                 Subject     => 'HRIS FTP Inbound to monster.com had
> problems and or failed!',
>                 Type        => 'multipart/related');
>
>                 #$msg->attach(
>                 #Type            => 'TEXT',
>                 #Disposition     => 'attachment',
>                 #Path            => "$ftplog",
>                 #Filename        => "$ftplog");
>                 $msg->send;
>         }
>
>
>
>
> my $overide   = $SIG{__DIE__}; ## get error handler currently assigned to
> die()
> $SIG{__DIE__} = sub {
>     my $error = shift;

$override is a coderef, not a hashref.  That is if it is set at all. 
If no handler has been previously registered with __DIE__ then it will
be blank.  That is why there is a ref check.  Your problem is that you
are using curly braces {} instead of parentheses ().

>     $overide->{$error} if (ref $overide);
>     mailme($error);
> };
>
> open (LOG, "+</var/log/derek") or die "Was unable to open file: $!";
> close (LOG);

--
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