On Thursday 31 May 2007, Alex Brelsfoard 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?
>

Perhaps you want to look at exceptions:

http://www.shlomifish.org/lecture/Perl/Newbies/lecture4/exceptions/

(Note: this is something I wrote.)

It's not exactly what you want, but you may be able to re-engineer your 
program using Object Oriented exceptions. Also look at Exception::Class, 
which has less dark magic than Error.pm, but has less syntactic sugar. (which 
in Error.pm's case is rather error-prone).

Regards,

        Shlomi Fish

---------------------------------------------------------------------
Shlomi Fish      [EMAIL PROTECTED]
Homepage:        http://www.shlomifish.org/

If it's not in my E-mail it doesn't happen. And if my E-mail is saying
one thing, and everything else says something else - E-mail will conquer.
    -- An Israeli Linuxer
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to