Subject: | Bizarre error for optional slurpy parameter |
The code
#!perl
use MooseX::Method::Signatures;
method foo(@rest?) {}
__END__
(a method with an explicitly optional slurpy @rest parameter) triggers
the following error:
Could not locate the base type (slurpyArrayRef) at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/i686-linux/Moose/Util/TypeConstraints.pm
line 136.
Moose::Util::TypeConstraints::create_parameterized_type_constraint('slurpyArrayRef[Any]')
called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/i686-linux/Moose/Util/TypeConstraints.pm
line 274
Moose::Util::TypeConstraints::find_or_parse_type_constraint('MooseX::Types::Structured::OverflowHandler=HASH(0x925b788)')
called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/i686-linux/Moose/Util/TypeConstraints.pm
line 260
Moose::Util::TypeConstraints::find_or_create_isa_type_constraint('MooseX::Types::Structured::OverflowHandler=HASH(0x925b788)')
called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/i686-linux/Moose/Meta/TypeConstraint/Parameterizable.pm
line 68
Moose::Meta::TypeConstraint::Parameterizable::_parse_type_parameter('MooseX::Meta::TypeConstraint::Structured::Optional=HASH(0x90a...',
'MooseX::Types::Structured::OverflowHandler=HASH(0x925b788)') called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/i686-linux/Moose/Meta/TypeConstraint/Parameterizable.pm
line 74
Moose::Meta::TypeConstraint::Parameterizable::parameterize('MooseX::Meta::TypeConstraint::Structured::Optional=HASH(0x90a...',
'MooseX::Types::Structured::OverflowHandler=HASH(0x925b788)') called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/MooseX/Meta/TypeConstraint/Structured/Optional.pm
line 13
Class::MOP::Class:::around('CODE(0x8a43a20)',
'MooseX::Meta::TypeConstraint::Structured::Optional=HASH(0x90a...',
'MooseX::Types::Structured::OverflowHandler=HASH(0x925b788)') called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/i686-linux/Class/MOP/Method/Wrapped.pm
line 162
Class::MOP::Method::Wrapped::__ANON__('MooseX::Meta::TypeConstraint::Structured::Optional=HASH(0x90a...',
'MooseX::Types::Structured::OverflowHandler=HASH(0x925b788)') called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/i686-linux/Class/MOP/Method/Wrapped.pm
line 91
MooseX::Meta::TypeConstraint::Structured::Optional::parameterize('MooseX::Meta::TypeConstraint::Structured::Optional=HASH(0x90a...',
'MooseX::Types::Structured::OverflowHandler=HASH(0x925b788)') called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/MooseX/Types.pm line 111
MooseX::Types::create_arged_type_constraint('MooseX::Types',
'MooseX::Types::Structured::Optional',
'MooseX::Types::Structured::OverflowHandler=HASH(0x925b788)') called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/MooseX/Types.pm line 79
__TYPE__::MooseX::Types::Structured::Optional('ARRAY(0x926a838)') called
at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/MooseX/Method/Signatures/Meta/Method.pm
line 249
MooseX::Method::Signatures::Meta::Method::_param_to_spec('MooseX::Method::Signatures::Meta::Method=HASH(0x90b45c0)',
'MooseX::Traits::__ANON__::SERIAL::1=HASH(0x926a498)') called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/MooseX/Method/Signatures/Meta/Method.pm
line 335
MooseX::Method::Signatures::Meta::Method::_build__positional_args('MooseX::Method::Signatures::Meta::Method=HASH(0x90b45c0)')
called at reader
MooseX::Method::Signatures::Meta::Method::_positional_args (defined at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/MooseX/Method/Signatures/Meta/Method.pm
line 62) line 7
MooseX::Method::Signatures::Meta::Method::_positional_args('MooseX::Method::Signatures::Meta::Method=HASH(0x90b45c0)')
called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/MooseX/Method/Signatures/Meta/Method.pm
line 369
MooseX::Method::Signatures::Meta::Method::_build_type_constraint('MooseX::Method::Signatures::Meta::Method=HASH(0x90b45c0)')
called at reader
MooseX::Method::Signatures::Meta::Method::type_constraint (defined at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/MooseX/Method/Signatures/Meta/Method.pm
line 81) line 7
MooseX::Method::Signatures::Meta::Method::type_constraint('MooseX::Method::Signatures::Meta::Method=HASH(0x90b45c0)')
called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/MooseX/Method/Signatures/Meta/Method.pm
line 174
Class::MOP::Class:::around('CODE(0x8829828)',
'MooseX::Method::Signatures::Meta::Method', 'CODE(0x9209428)',
'signature', '(@rest?)', 'name', 'foo', 'package_name', 'main', ...)
called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/i686-linux/Class/MOP/Method/Wrapped.pm
line 162
Class::MOP::Method::Wrapped::__ANON__('MooseX::Method::Signatures::Meta::Method',
'CODE(0x9209428)', 'signature', '(@rest?)', 'name', 'foo',
'package_name', 'main') called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/i686-linux/Class/MOP/Method/Wrapped.pm
line 91
MooseX::Method::Signatures::Meta::Method::wrap('MooseX::Method::Signatures::Meta::Method',
'CODE(0x9209428)', 'signature', '(@rest?)', 'name', 'foo',
'package_name', 'main') called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/MooseX/Method/Signatures.pm
line 259
MooseX::Method::Signatures::_parser('MooseX::Method::Signatures=HASH(0x8678230)',
'method', 0) called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/MooseX/Method/Signatures.pm
line 200
eval {...} called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/MooseX/Method/Signatures.pm
line 200
MooseX::Method::Signatures::parser('MooseX::Method::Signatures=HASH(0x8678230)',
'method', 0) called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/MooseX/Method/Signatures.pm
line 97
MooseX::Method::Signatures::__ANON__('method', 0) called at
/home/mauke/usr/lib/perl5/site_perl/5.16.1/i686-linux/Devel/Declare.pm
line 276
Devel::Declare::linestr_callback('const', 'method', 0) called at
bug line 2
It should either Just Work or say something like "slurpy params can't be
optional, dummy".