in reply to Re: Moose trait (?) to set "undef" to, say, "empty string?"
in thread [SOLVED] Moose trait (?) to set "undef" to, say, "empty string?"
If by magick you mean the well documented way in which coercions work, the answer is yes. :\
Moose::Manual::Types: Moose will never try to coerce a value unless you explicitly ask for it. This is done by setting the coerce attribute option to a true value...
Moose::Cookbook::Basics::Recipe5: However, defining the coercion doesn't do anything until we tell Moose we want a particular attribute to be coerced...
Moose: coerce => (1|0) This will attempt to use coercion with the supplied type constraint to change the value passed into any accessors or constructors. You must supply a type constraint, and that type constraint must define a coercion...
See also, Moose::Manual::FAQ and probably other spots.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Moose trait (?) to set "undef" to, say, "empty string?"
by locked_user sundialsvc4 (Abbot) on Nov 29, 2011 at 15:39 UTC |