From: Lukas Mai Date: Sun, 16 Jun 2013 18:02:03 +0000 (+0200) Subject: formatting and stuff X-Git-Tag: v1.0104~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=11c807bcfb7dc67743edd587d13899e0183db279;p=p5sagit%2FFunction-Parameters.git formatting and stuff --- diff --git a/README b/README index e67868f..1ab33fe 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ Function-Parameters -Simple parameter lists for perl subroutines. +subroutine definitions with parameter lists INSTALLATION @@ -30,8 +30,8 @@ You can also look for information at: CPAN Ratings http://cpanratings.perl.org/d/Function-Parameters - Search CPAN - http://search.cpan.org/dist/Function-Parameters/ + MetaCPAN + https://metacpan.org/module/Function::Parameters COPYRIGHT AND LICENCE diff --git a/lib/Function/Parameters.pm b/lib/Function/Parameters.pm index 82d7486..d7cc7af 100644 --- a/lib/Function/Parameters.pm +++ b/lib/Function/Parameters.pm @@ -1,7 +1,6 @@ package Function::Parameters; use v5.14.0; - use warnings; use Carp qw(confess); @@ -57,32 +56,32 @@ sub _assert_valid_attributes { my @bare_arms = qw(function method); my %type_map = ( - function => { - name => 'optional', - default_arguments => 1, + function => { + name => 'optional', + default_arguments => 1, check_argument_count => 0, - named_parameters => 1, - types => 1, + named_parameters => 1, + types => 1, }, - method => { - name => 'optional', - default_arguments => 1, + method => { + name => 'optional', + default_arguments => 1, check_argument_count => 0, - named_parameters => 1, - types => 1, - attrs => ':method', - shift => '$self', - invocant => 1, + named_parameters => 1, + types => 1, + attrs => ':method', + shift => '$self', + invocant => 1, }, - classmethod => { - name => 'optional', - default_arguments => 1, + classmethod => { + name => 'optional', + default_arguments => 1, check_argument_count => 0, - named_parameters => 1, - types => 1, - attributes => ':method', - shift => '$class', - invocant => 1, + named_parameters => 1, + types => 1, + attributes => ':method', + shift => '$class', + invocant => 1, }, ); for my $k (keys %type_map) { @@ -160,15 +159,15 @@ sub import { my $type = $spec{$kw}; my $flags = - $type->{name} eq 'prohibited' ? FLAG_ANON_OK : - $type->{name} eq 'required' ? FLAG_NAME_OK : - FLAG_ANON_OK | FLAG_NAME_OK + $type->{name} eq 'prohibited' ? FLAG_ANON_OK : + $type->{name} eq 'required' ? FLAG_NAME_OK : + FLAG_ANON_OK | FLAG_NAME_OK ; - $flags |= FLAG_DEFAULT_ARGS if $type->{default_arguments}; + $flags |= FLAG_DEFAULT_ARGS if $type->{default_arguments}; $flags |= FLAG_CHECK_NARGS | FLAG_CHECK_TARGS if $type->{check_argument_count}; - $flags |= FLAG_INVOCANT if $type->{invocant}; - $flags |= FLAG_NAMED_PARAMS if $type->{named_parameters}; - $flags |= FLAG_TYPES_OK if $type->{types}; + $flags |= FLAG_INVOCANT if $type->{invocant}; + $flags |= FLAG_NAMED_PARAMS if $type->{named_parameters}; + $flags |= FLAG_TYPES_OK if $type->{types}; $^H{HINTK_FLAGS_ . $kw} = $flags; $^H{HINTK_SHIFT_ . $kw} = $type->{shift}; $^H{HINTK_ATTRS_ . $kw} = $type->{attrs}; @@ -623,9 +622,9 @@ L|Carp>. The predefined type C is equivalent to: { - name => 'optional', - invocant => 0, - default_arguments => 1, + name => 'optional', + invocant => 0, + default_arguments => 1, check_argument_count => 0, } @@ -634,11 +633,11 @@ These are all default values, so C is also equivalent to C<{}>. C is equivalent to: { - name => 'optional', - shift => '$self', - invocant => 1, - attributes => ':method', - default_arguments => 1, + name => 'optional', + shift => '$self', + invocant => 1, + attributes => ':method', + default_arguments => 1, check_argument_count => 0, } @@ -646,11 +645,11 @@ C is equivalent to: C is equivalent to: { - name => 'optional', - shift => '$class', - invocant => 1, - attributes => ':method', - default_arguments => 1, + name => 'optional', + shift => '$class', + invocant => 1, + attributes => ':method', + default_arguments => 1, check_argument_count => 0, } diff --git a/lib/Function/Parameters/Info.pm b/lib/Function/Parameters/Info.pm index 382f7e3..ebbb7b3 100644 --- a/lib/Function/Parameters/Info.pm +++ b/lib/Function/Parameters/Info.pm @@ -1,7 +1,6 @@ package Function::Parameters::Info; use v5.14.0; - use warnings; our $VERSION = '0.03'; @@ -24,7 +23,7 @@ BEGIN { BEGIN { $Moo->import; } use overload fallback => 1, - '""' => sub { $_[0]->name }, + '""' => sub { $_[0]->name }, ; has $_ => (is => 'ro') for qw(name type);