Hi Michael,
On 5/24/06, Michael Mathews <[EMAIL PROTECTED]> wrote:
Oh "try"! I like that! But is CATCH implemented in pugs? Anyone care
to give a working example of try/CATCH?
I don't think CATCH is implemented in pugs yet:
#!/usr/local/bin/pugs
catcher;

sub catcher {
   say "here";
   try {
       fail_trying;
       say "tried";
       CATCH {
           say "catch";
       }
   }
   if $! {
       say "error";
   }
   say "there";
}

sub fail_trying {
   fail_ "failed";
}

OUTPUT:
here
tried
error
there

I used fail_ instead of die because I saw it somewhere, but don't
really know the reason to use it instead of die. Anyway, hope that is
at least some help.

David

Reply via email to