err has asked for the wisdom of the Perl Monks concerning the following question:
Hi there,
I'm writing code using MooseX::Declare.
Now I experienced some trouble when initializing a new object using:
my $f = new Foo( one => 'valued', two => undef );
Foo.pm
use MooseX::Declare; class Foo { has 'one' => (is => 'rw', isa => 'Str'); has 'two' => (is => 'rw', isa => 'Str'); };
moose complains that two isn't the type which expected.
Short, it happens what MooseX::UndefTolerant tries to avoid. But this module does nothing if I use MooseX::Declare to write a class. I tried both ways, the standard way to make all attributes undef tolerant and the other way using traits. But both had no effect.
So anyone can help me? Thank you!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MooseX::Declare and undef attributes - MooseX::UndefTolerant not working
by ikegami (Patriarch) on Sep 24, 2010 at 14:09 UTC | |
by err (Novice) on Sep 26, 2010 at 12:15 UTC | |
by ikegami (Patriarch) on Sep 26, 2010 at 16:40 UTC | |
by err (Novice) on Sep 26, 2010 at 22:23 UTC | |
by ikegami (Patriarch) on Sep 26, 2010 at 22:39 UTC | |
|
Re: MooseX::Declare and undef attributes - MooseX::UndefTolerant not working
by bobr (Monk) on Sep 25, 2010 at 18:08 UTC |