Subject: | RunnableClass subtype is too restrictive |
When making the class 'B5::HelloWorld' runnable as per the example in
the docs, I get:
: [www-data@karene codescraps/mx-run].0$; mx-run -I. B5::HelloWorld ether
Attribute (class) does not pass the type constraint because: Validation
failed for 'MooseX::Runnable::Invocation::RunnableClass' with value
B5::HelloWorld at
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Moose/Meta/Attribute.pm
line 746
Moose::Meta::Attribute::_coerce_and_verify('Moose::Meta::Attribute=HASH(0xa3a124c)',
'B5::HelloWorld', 'MooseX::Runnable::Invocation::MxRun=HASH(0xa3a62cc)')
called at
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Moose/Meta/Attribute.pm
line 398
Moose::Meta::Attribute::initialize_instance_slot('Moose::Meta::Attribute=HASH(0xa3a124c)',
'Moose::Meta::Instance=HASH(0xa3c16cc)',
'MooseX::Runnable::Invocation::MxRun=HASH(0xa3a62cc)',
'HASH(0xa3a64d0)') called at
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Class/MOP/Class.pm line
567
Class::MOP::Class::_construct_instance('Moose::Meta::Class=HASH(0xa1211ec)',
'HASH(0xa3a64d0)') called at
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Class/MOP/Class.pm line
540
Class::MOP::Class::new_object('Moose::Meta::Class=HASH(0xa1211ec)',
'HASH(0xa3a64d0)') called at
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Moose/Meta/Class.pm
line 256
Moose::Meta::Class::new_object('Moose::Meta::Class=HASH(0xa1211ec)',
'HASH(0xa3a64d0)') called at
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Moose/Object.pm
line 25
Moose::Object::new('MooseX::Runnable::Invocation::MxRun',
'class', 'B5::HelloWorld', 'plugins', 'HASH(0xa27ce10)', 'parsed_args',
'MooseX::Runnable::Util::ArgParser=HASH(0xa3255e0)') called at
/usr/bin/mx-run line 35
main::run() called at /usr/bin/mx-run line 9
This is because of the definition in MooseX::Runnable::Invocation:
subtype RunnableClass,
as Str,
where { $_ =~ /^[:A-Za-z_]+$/ };
It really ought to accept any valid Moose class:
subtype RunnableClass,
as ClassName,
where { $_->can('does') and $_->does('MooseX::Runnable' };
This is breaking my heart because the app name of my project is 'B5'. :)