On Mon, Feb 15, 2010 at 06:31:24PM -0600, Jesse Luehrs wrote: > On Mon, Feb 15, 2010 at 04:25:54PM -0800, Karen Etheridge wrote: > I'm not sure what problem you're having, since you didn't post the > error message,
Oops sorry, it was: Attribute (date) does not pass the type constraint because: Validation failed for 'MaybeDateTime' failed with value 0000-00-00 00:00:00 (not isa MaybeDateTime) at ... > but you probably need the attribute definition to happen > after the types are defined... pretty sure this would assume you have a > class named 'MaybeDateTime'. Doh, of course! After moving the 'has' line to the end of the module, now I get: Can't call method "isa" on an undefined value at Object.pm line 15. ...where line 15 is the "where" line of the subtype 'MaybeDateTime' definition. However, I see that I'm dereferencing $_ before checking its definedness, so if I switch to: => where { not defined $_ or $_->isa('DateTime') }; ...then the object constructs properly! Hurrah! (I suspect that perhaps some of the coercions I have created are unnecessary; I'll look into that next to see if I can remove them.) doy++ :) -- "Whoever acquires knowledge but does not practice it is as one who ploughs but does not sow." - Sa'di . . . . . Karen Etheridge, ka...@etheridge.ca GCS C+++$ USL+++$ P+++$ w--- M++ http://etheridge.ca/ PS++ PE-- b++ DI++++ e++ h(-)