From: Stevan Little Date: Mon, 7 May 2007 16:37:03 +0000 (+0000) Subject: tweaking X-Git-Tag: 0.18_01~85 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=21c7045b59fb515ba35d15a0314939b58dd51284;p=gitmo%2FMooseX-AttributeHelpers.git tweaking --- diff --git a/lib/MooseX/AttributeHelpers/Base.pm b/lib/MooseX/AttributeHelpers/Base.pm index 267ffbe..3d13d16 100644 --- a/lib/MooseX/AttributeHelpers/Base.pm +++ b/lib/MooseX/AttributeHelpers/Base.pm @@ -31,6 +31,7 @@ sub helper_type { () } sub process_options_for_provides { my ($self, $options) = @_; + if (my $type = $self->helper_type) { (exists $options->{isa}) || confess "You must define a type with the $type metaclass"; diff --git a/lib/MooseX/AttributeHelpers/Counter.pm b/lib/MooseX/AttributeHelpers/Counter.pm index 86c1317..0e8fb70 100644 --- a/lib/MooseX/AttributeHelpers/Counter.pm +++ b/lib/MooseX/AttributeHelpers/Counter.pm @@ -54,11 +54,13 @@ MooseX::AttributeHelpers::Counter default => sub { 0 }, provides => { inc => 'inc_counter', + dec => 'dec_counter', } ); my $page = MyHomePage->new(); $page->inc_counter; # same as $page->counter($page->counter + 1); + $page->dec_counter; # same as $page->counter($page->counter - 1); =head1 DESCRIPTION