Michal Wallace <[EMAIL PROTECTED]> wrote:

> Here's a new test case for t/pmc/sub.t

> ########
> output_is(<<'CODE', <<'OUTPUT', "set_eh - throw - clear_eh");
>     print "start\n"
>     newsub P20, .Exception_Handler, _handler
>     set_eh P20
>     new P30, .Exception
>     throw P30
>     print "not reached\n"
>     end
> _handler:
>     clear_eh
>     print "caught it\n"
>     end
> CODE
> start
> caught it
> OUTPUT
> #########

[ panic ]

> I don't know if my test is right or not, but I'm
> expecting the exception handler to still be around
> after the exception is caught.

No, the exception object isn't around anymore in the handler, so you
don't C<clear_eh> there.

This could of course be just my wrong implementation.

> I don't care if it goes away after the exception is
> caught, but I need a way to clear the exception
> handler after I get out of the try/except or
> try/finally block... Otherwise later exceptions
> will bring me backward in the code. :/

Can you insert C<clear_eh> before you fall through to except/finally?

> Sincerely,
>
> Michal J Wallace

leo

Reply via email to