Benh, On Aug 24, 2008, at 6:59 PM, benh wrote:
ok this is an overly simplistic example of what I'm trying to do but in the end I was expecting that default would trigger coerce, though it looks like it does not. Should it? or am I expecting something to work in a completely stupid way (it's happened before)?
No, according to the code coerce will always fire for a default, I think the problem is ...
has data => ( is => 'rw', isa => 'split_types', coerce => 1, default => sub{ () }, );
'default' is returning nothing here, it should be returning []
# THIS TEST FAILS! lives_ok { My::Test->new }, q{~shouldn't~ this pass?};
I suspect that if you printed out the exception, it would tell you that the value returned from default did not pass the type constraint.
- Stevan