From: Lukas Mai Date: Mon, 18 Jun 2012 13:19:24 +0000 (+0200) Subject: document planned 'attrs' feature X-Git-Tag: v0.06~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=273c6544dcb5773b64d135f6671b999dce09ec45;p=p5sagit%2FFunction-Parameters.git document planned 'attrs' feature --- diff --git a/lib/Function/Parameters.pm b/lib/Function/Parameters.pm index d7e6ddd..dc96207 100644 --- a/lib/Function/Parameters.pm +++ b/lib/Function/Parameters.pm @@ -226,10 +226,28 @@ Valid values: strings that look like a scalar variable. Any function created by this keyword will automatically L its first argument into a local variable whose name is specified here. +=item C + +Valid values: strings that are valid source code for attributes. Any value +specified here will be inserted as a subroutine attribute in the generated +code. Thus: + + use Function::Parameters { sub_l => { attrs => ':lvalue' } }; + sub_l foo() { + ... + } + +turns into + + sub foo :lvalue { + ... + } + =back Plain C<'function'> is equivalent to C<< { name => 'optional' } >>, and plain -C<'method'> is equivalent to C<< { name => 'optional', shift => '$self' } >>. +C<'method'> is equivalent to +C<< { name => 'optional', shift => '$self', attrs => ':method' } >>. =head2 Syntax and generated code