Use die() or croak() paired with eval() for exception-passing.

use Carp qw(carp croak);

sub Plort {
 ...
 ...
 eval { Foo() };
 if ($@) {
    carp "Onoz, an error!!";
    do_something_with_error($@);
 }
 ...
}

sub Foo {
 ...
 ...
 croak(Error());
 ...
}

Alernately, have the Error sub throw the exception instead.

On 5/31/07, Alex Brelsfoard <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I'm looking for a quick and easy way to have this situation happen:
>
> sub Plort {
>     ...
>     ...
>    Foo();
>     ...
> }
>
> sub Foo {
>     ...
>     ...
>     Error();
>     ...
> }
>
>
> I want it to happen that when Error() is called, when Error() finishes doing
> what it does it returns you to it's parent's parent (Plort() in this case).
> I don't want to have to specify anything.
> I want it to always return you to where Error()'s grandparent called it's
> parent.
>
> Any ideas of how to do this?
>
> Thanks.
> --Alex
>
> _______________________________________________
> Boston-pm mailing list
> [email protected]
> http://mail.pm.org/mailman/listinfo/boston-pm
>


-- 
Jason McIntosh
Email:  [EMAIL PROTECTED]
Jabber: [EMAIL PROTECTED]
AIM:    zendonut
Cell:   617-792-3829

President and Founder
Volity Games
http://volity.net
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to