[ABE.pm] trapping warnings

Ted Fiedler fiedlert at gmail.com
Thu Oct 4 17:22:11 PDT 2007


$SIG{__DIE__}  = \&customDie;
$SIG{__WARN__} = \&customWarn;

that should do the trick. and in sub customDie { print $LOG "Im dying:
$!\n"; exit 1; }
with a similar customWarn... Assuming of course that you have $LOG open for
writing :)

On 10/4/07, Faber J. Fedor <faber at linuxnj.com> wrote:
>
> I've got some code like this:
>
>   $sum = $indexTable2->elm($i, "weight");
>   while ($sum <= $captPercentile) {
>       $sum += $indexTable2->elm($i+1, "weight");
>       $bottom_count ++;
>       $i++;
>   }
>
> If indexTable2 is empty (it should never be, but hey this is RL), I get
> errors like:
>
> Row index out of range [0..-1]Use of uninitialized value in addition (+)
> at /home/sqa/bin/processMonthlyData.pl line 497.
>
> And the program will sit in that loop forever, spitting out this
> warning/error to STDOUT.
>
> How do I trap this and DIE with an error message?
>
>
> --
>
> Regards,
>
> Faber Fedor
> President
> Linux New Jersey, Inc.
> 908-320-0357
> 800-706-0701
>
> http://www.linuxnj.com
>
>
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
> _______________________________________________
> ABE-pm mailing list
> ABE-pm at pm.org
> http://mail.pm.org/mailman/listinfo/abe-pm
>



-- 
If you mess with a thing long enough, it'll break.
                -- Schmidt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/abe-pm/attachments/20071004/3ea6574d/attachment.html 


More information about the ABE-pm mailing list