On 8/30/06, Mark Stosberg <[EMAIL PROTECTED]> wrote:

Sometimes I use 'given' blocks to set a value. To save repeating myself
on the right hand side of the given block, I found I kept want to do this:

my $foo = given { }


According to S04, given {} is at statement level, so you can't use it
directly as an expression. But Perl 6 always allow you to say

 my $foo = do given {...}

As well as

 my $foo = do if foo {...} else {...}


my $rm = sub { given $rm_param {
        when Code  { $rm_param(self)   }
        when Hash  { %rm_param<run_mode> }
        default    { self.query.param($rm_param) }
    }}();


Apparently ``do'' is a simplified version for this. :)

Cheers,
Agent

Reply via email to