graq has asked for the wisdom of the Perl Monks concerning the following question:
error:
Sort subroutine didn't return single value.
script.pl died with a software error
Code snippet:
Now I know that the sort (at EVAL1)is failing, because the 'rank' method does not exist on the 'message' object.my $messages = get_arrayref_of_objects; eval { $messages = [ sort { $a=>rank <=> $b->rank } @$messages ]; }; # + EVAL1 $LOG_OB->warning( "Sort failed: $@" ); foreach my $message (@$messages) { eval { $message->do_some_method; }; #EVAL2 # <1> if ($@) { $LOG_OB->fatal( "YOIKES: $@" ); } }
But why is the sort failure logging this error?
Is $@ still defined at <1> even though the previous
eval has no problems (EVAL2 never fails)?
Or is it something completely
different and I am barking up the wrong tree?
--
Graq
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl behaviour - is it '$@' or 'sort' causing me grief?
by runrig (Abbot) on Sep 19, 2001 at 20:13 UTC | |
|
Re: Perl behaviour - is it '$@' or 'sort' causing me grief?
by boo_radley (Parson) on Sep 19, 2001 at 22:29 UTC | |
by graq (Curate) on Sep 20, 2001 at 11:56 UTC |