nmerriweather has asked for the wisdom of the Perl Monks concerning the following question:
note, thats a simplified version.sub check_id { my ( $id )= @_; my $res; eval { my $obj= ObjClass::Obj->new(); $obj->id( $id ); $obj->load_via_id() ; $res= $obj->id ; die "invalid user" unless $obj->activated_account ; } if ($@) { DEBUG && log_error( $@ ); return -1; } return $res; }
load_via_id could die and toss an exception - at which point things work as they should. i want to catch that die.$obj->load_via_id() ; die "invalid user" unless $obj->activated_account ;
someone out there with more experience than me must have a suggestion! i hope!if ( !$obj->activated_account ) { $suppres_warning++; die "invalid account"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: novice 'die' help requested
by friedo (Prior) on Jan 11, 2007 at 19:50 UTC | |
|
Re: novice 'die' help requested
by jettero (Monsignor) on Jan 11, 2007 at 20:03 UTC | |
|
Re: novice 'die' help requested
by muba (Priest) on Jan 11, 2007 at 21:53 UTC | |
by friedo (Prior) on Jan 11, 2007 at 22:18 UTC | |
by muba (Priest) on Jan 11, 2007 at 23:46 UTC | |
by nmerriweather (Friar) on Jan 13, 2007 at 01:03 UTC | |
|
Re: novice 'die' help requested
by ikegami (Patriarch) on Jan 11, 2007 at 20:35 UTC | |
by f00li5h (Chaplain) on Jan 11, 2007 at 23:21 UTC | |
|
Re: novice 'die' help requested
by sfink (Deacon) on Jan 12, 2007 at 17:38 UTC | |
|
Re: novice 'die' help requested
by TOD (Friar) on Jan 17, 2007 at 18:20 UTC |