On Sun, 18 Jul 2010, Ævar Arnfjörð Bjarmason wrote:

2b54d2a6b7bf40c4408ffbc117f6b6d77ee35c67 by Dave Rolsky broke this
DWIM MX::Getopt program:

   package Xailo;
   use 5.012;
   use Any::Moose;
   with any_moose('X::Getopt');

   has args => (
       documentation => "Arguments for the engine class",
       isa           => 'HashRef',
       coerce        => 1,
       is            => "ro",
       default       => sub { +{} },
   );

   sub run {
       my ($self) = @_;

       say "$_ = $self->{args}{$_}" for sort keys %{ $self->{args} };
   }

   package xailo;
   Xailo->new_with_options->run;

Before:

   foo = bar
   this = that

After:

   Attribute (args) does not pass the type constraint because:
Validation failed for 'HashRef' with value foo at
/home/v-perlbrew/perl5/perlbrew/perls/perl-5.13.2/lib/site_perl/5.13.2/x86_64-linux/Moose/Meta/Attribute.pm
line 746

Can this be made to work instead of dying? Perhaps a coercion needs to
be added to MooseX::Getopt?

Well, it shouldn't die any more, just warn. But it still should be fixed.

I don't understand why you're passing "coerce => 1" there. Where is the coercion defined?


-dave

/*============================================================
http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)
============================================================*/

Reply via email to