in reply to Cannot coerce from Bool to Str
Update: The common way to have a boolean yes/no attribute in Moose would be something like
package Thing; use Moose; use Moose::Util::TypeConstraints qw{ enum }; has delete => (is => 'ro', isa => enum([qw[ yes no ]]), init_arg => undef, lazy => 1, builder => '_build_delete'); has _delete => (is => 'ro', isa => 'Bool', init_arg => 'delete'); sub _build_delete { my ($self) = @_; $self->_delete ? 'yes' : 'no' }
I'm a bit uncomfortable with _delete having a constructor argument delete that has the same name as an attribute that has no init argument, but it seems to work.
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|