From: Peter Rabbitson Date: Tue, 1 Jun 2010 22:39:56 +0000 (+0200) Subject: Add docs about @_ aliasing X-Git-Tag: Try-Tiny-0.07~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=013dca8f4c2c4a9932f9b632f42eb6d5d1bcc857;p=p5sagit%2FTry-Tiny.git Add docs about @_ aliasing --- diff --git a/lib/Try/Tiny.pm b/lib/Try/Tiny.pm index 0cb7212..b1dafa5 100644 --- a/lib/Try/Tiny.pm +++ b/lib/Try/Tiny.pm @@ -394,13 +394,23 @@ concisely match errors: =item * -C<@_> is not available, you need to name your args: +C<@_> is not available within the C block, so you need to copy your +arglist. In case you want to work with argument values directly via C<@_> +aliasing (i.e. allow C<$_[1] = "foo">), you need to pass C<@_> by reference: sub foo { my ( $self, @args ) = @_; try { $self->bar(@args) } } +or + + sub bar_in_place { + my $self = shift; + my $args = \@_; + try { $_ = $self->bar($_) for @$args } + } + =item * C returns from the C block, not from the parent sub (note that