X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FAttributeHelpers%2FBool.pm;h=fb324a25c470cdce537b5fbd105ac5501aacb27d;hb=8ba9223461d20f3978f61c367b5fe57fa963e335;hp=71d643d1ad3e051bb410f0baf7935d41c372cb40;hpb=3f58c364a8760b02b72f5cb487e6c94ecdaaf363;p=gitmo%2FMooseX-AttributeHelpers.git diff --git a/lib/MooseX/AttributeHelpers/Bool.pm b/lib/MooseX/AttributeHelpers/Bool.pm index 71d643d..fb324a2 100644 --- a/lib/MooseX/AttributeHelpers/Bool.pm +++ b/lib/MooseX/AttributeHelpers/Bool.pm @@ -2,7 +2,8 @@ package MooseX::AttributeHelpers::Bool; use Moose; use MooseX::AttributeHelpers::MethodProvider::Bool; -our $VERSION = '0.12'; +our $VERSION = '0.14'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; extends 'MooseX::AttributeHelpers::Base'; @@ -18,7 +19,16 @@ sub helper_type { 'Bool' } has '+method_provider' => ( default => 'MooseX::AttributeHelpers::MethodProvider::Bool' ); - + +before 'process_options_for_provides' => sub { + my ($self, $options, $name) = @_; + + # Set some default attribute options here unless already defined + if ((my $type = $self->helper_type) && !exists $options->{isa}){ + $options->{isa} = $type; + } +}; + no Moose; # register the alias ... @@ -43,7 +53,7 @@ MooseX::AttributeHelpers::Bool has 'is_lit' => ( metaclass => 'Bool', is => 'rw', - isa => 'Int', + isa => 'Bool', default => sub { 0 }, provides => { set => 'illuminate', @@ -74,6 +84,10 @@ basic math operations. =item B +=item B + +=item B + =back =head1 PROVIDED METHODS