Subject: | Parameters cannot be used in defaults |
It can be useful to use required parameters in the defaults of later optional ones, especially if they're positional. Kavorka does not support this. Method::Signatures and Function::Parameters do.
$ perl -wle 'use Kavorka; fun test ( $one, $two = $one + $one ) { print $two } test(2)'
Use of uninitialized value $one in addition (+) at -e line 1.
Use of uninitialized value $one in addition (+) at -e line 1.
0
$ perl -wle 'use strict; use Kavorka; fun test ( $one, $two = $one + $one ) { print $two } test(2)'
Global symbol "$one" requires explicit package name at -e line 1.
Global symbol "$one" requires explicit package name at -e line 1.
BEGIN not safe after errors--compilation aborted at /Users/schwern/perl5/perlbrew/perls/perl-5.18.1-thread/lib/site_perl/5.18.1/Kavorka/TraitFor/Parameter/optional.pm line 1.
Compilation failed in require at /Users/schwern/perl5/perlbrew/perls/perl-5.18.1-thread/lib/site_perl/5.18.1/Module/Runtime.pm line 317.
$ perl -wle 'use Kavorka; fun test ( $one, $two = $one + $one ) { print $two } test(2)'
Use of uninitialized value $one in addition (+) at -e line 1.
Use of uninitialized value $one in addition (+) at -e line 1.
0
$ perl -wle 'use strict; use Kavorka; fun test ( $one, $two = $one + $one ) { print $two } test(2)'
Global symbol "$one" requires explicit package name at -e line 1.
Global symbol "$one" requires explicit package name at -e line 1.
BEGIN not safe after errors--compilation aborted at /Users/schwern/perl5/perlbrew/perls/perl-5.18.1-thread/lib/site_perl/5.18.1/Kavorka/TraitFor/Parameter/optional.pm line 1.
Compilation failed in require at /Users/schwern/perl5/perlbrew/perls/perl-5.18.1-thread/lib/site_perl/5.18.1/Module/Runtime.pm line 317.