Also see Moose::Manual::Delta for more details of, and workarounds
for, noteworthy changes.
+Next
+ * Moose::Meta::Attribute::Native::Trait::Counter
+ * Moose::Meta::Attribute::Native::Trait::String
+ - For these two traits, an attribute which did not explicitly provide
+ methods to handles magically ended up delegating *all* the helper
+ methods. This has been removed. You must be explicit in your handles
+ declaration for all Native Traits. (Dave Rolsky)
+
0.89_02 Thu, Sep 10, 2009
* Moose::Meta::Attribute::Native
- Fix Hash, which still had 'empty' instead of 'is_empty'. (hdp)
sub _default_is { 'ro' }
sub _helper_type { 'Num' }
-after '_check_handles_values' => sub {
- my $self = shift;
- my $handles = $self->handles;
-
- unless ( scalar keys %$handles ) {
- my $method_constructors = $self->method_constructors;
- my $attr_name = $self->name;
-
- foreach my $method ( keys %$method_constructors ) {
- $handles->{ $method . '_' . $attr_name } = $method;
- }
-
- $self->_set_handles($handles);
- }
-};
-
no Moose::Role;
1;
sub _default_is { 'rw' }
sub _helper_type { 'Str' }
-after '_check_handles_values' => sub {
- my $self = shift;
- my $handles = $self->handles;
-
- unless ( scalar keys %$handles ) {
- my $method_constructors = $self->method_constructors;
- my $attr_name = $self->name;
-
- foreach my $method ( keys %$method_constructors ) {
- $handles->{$method} = ( $method . '_' . $attr_name );
- }
- }
-};
-
no Moose::Role;
1;
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More tests => 12;
-use Test::Moose;
-
-{
- package MyHomePage;
- use Moose;
-
- has 'counter' => ( traits => ['Counter'] );
-}
-
-my $page = MyHomePage->new();
-isa_ok( $page, 'MyHomePage' );
-
-can_ok( $page, $_ ) for qw[
- dec_counter
- inc_counter
- reset_counter
-];
-
-is( $page->counter, 0, '... got the default value' );
-
-$page->inc_counter;
-is( $page->counter, 1, '... got the incremented value' );
-
-$page->inc_counter;
-is( $page->counter, 2, '... got the incremented value (again)' );
-
-$page->dec_counter;
-is( $page->counter, 1, '... got the decremented value' );
-
-$page->reset_counter;
-is( $page->counter, 0, '... got the original value' );
-
-# check the meta ..
-
-my $counter = $page->meta->get_attribute('counter');
-does_ok( $counter, 'Moose::Meta::Attribute::Native::Trait::Counter' );
-
-is( $counter->type_constraint->name, 'Num',
- '... got the expected default type constraint' );
-
-is_deeply(
- $counter->handles,
- {
- 'inc_counter' => 'inc',
- 'dec_counter' => 'dec',
- 'reset_counter' => 'reset',
- 'set_counter' => 'set',
- },
- '... got the right default handles methods'
-);
-