On 5/4/05, Larry Wall <[EMAIL PROTECTED]> wrote:
> To get the other behavior, you have to say one of:
> 
>     given "hello" {
>         when /hello/ {
>             say "One";
>             when /hello/ { say "Two"; continue; }
>             when /hello/ { say "Three"; continue; }
>             continue;
>         }
>         say "Four";
>     }
> 
>     given "hello" {
>         when /hello/ {
>             say "One";
>             say "Two" when /hello/;
>             say "Three" when /hello/;
>             continue;
>         }
>         say "Four";
>     }
> 
>     given "hello" {
>         when /hello/ {
>             say "One";
>             if /hello/ { say "Two"; }
>             if /hello/ { say "Three"; }
>             continue;
>         }
>         say "Four";
>     }
> 
> That seems like enough WTDI. 

Not quite.  There's also the way that I have it in the pugs IRC bot:

    given "hello" {
        when /hello/ {
            given $_ {
                say "One";
                when /hello/ { say "Two" }
                when /hello/ { say "Three" }
            }
        }
        say "Four";
    }

Which I actually like the best.  If only it weren't so heavily indented.

Hmmm, maybe I should go implement Acme::Whiven:

    given "hello" {
        whiven /hello/ {
            when /hello/ {...}
            ...
        }
    }

Luke

Reply via email to