From 318cb1eb7cbaceb01b470f83c816b669885a1ec9 Mon Sep 17 00:00:00 2001 From: Yuval Kogman Date: Tue, 20 Oct 2009 23:31:54 +0200 Subject: [PATCH] document the @_ gotcha --- lib/Try/Tiny.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/Try/Tiny.pm b/lib/Try/Tiny.pm index 5212a30..7c0256d 100644 --- a/lib/Try/Tiny.pm +++ b/lib/Try/Tiny.pm @@ -291,6 +291,27 @@ concisely match errors: =item * +C<@_> is not available, you need to name your args: + + sub foo { + my ( $self, @args ) = @_; + try { $self->bar(@args) } + } + +=item * + +C returns from the C block, not from the parent sub (note that +this is also how C works, but not how L works): + + sub bar { + try { return "foo" }; + return "baz"; + } + + say bar(); # "baz" + +=item * + C introduces another caller stack frame. L is not used. L will report this when using full stack traces. This lack of magic is considered a feature.