From: Lukas Mai Date: Tue, 9 Aug 2011 09:41:33 +0000 (+0200) Subject: document changes X-Git-Tag: v0.05_01~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ce052c57531e7999a01e0f9ddc404d95dd28d94e;p=p5sagit%2FFunction-Parameters.git document changes --- diff --git a/lib/Function/Parameters.pm b/lib/Function/Parameters.pm index 2594d85..1200d69 100644 --- a/lib/Function/Parameters.pm +++ b/lib/Function/Parameters.pm @@ -417,9 +417,9 @@ you pass a hash reference in the import list: The first line creates two keywords, C and C (for defining functions and methods, respectively). The last two lines only create one keyword. Generally the hash keys can be any identifiers you want while the -values have to be either C or C. The difference between -C and C is that Cs automatically -L their first argument into C<$self>. +values have to be either C, C, or a hash reference (see +below). The difference between C and C is that Cs +automatically L their first argument into C<$self>. The following shortcuts are available: @@ -443,6 +443,29 @@ The following shortcuts are available: # is equivalent to # use Function::Parameters { 'foo' => 'function', 'bar' => 'method' }; +You can customize things even more by passing a hashref instead of C +or C. This hash can have the following keys: + +=over + +=item C + +Valid values: C (default), C (all uses of this keyword must +specify a function name), and C (all uses of this keyword must not +specify a function name). This means a C<< name => 'prohibited' >> keyword can +only be used for defining anonymous functions. + +=item C + +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 with the name specified here. + +=back + +Plain C is equivalent to C<< { name => 'optional' } >>, and plain +C is equivalent to C<< { name => 'optional', shift => '$self'} >>. + =head2 Other advanced stuff Normally, Perl subroutines are not in scope in their own body, meaning the