- coerce and lazy now work together correctly, thanks to
merlyn for finding this bug
- tests added for this
+ - fix reader presedence bug in Moose::Meta::Attribute + tests
0.21 Thursday, May 2nd, 2007
* Moose
if (exists $options->{is}) {
if ($options->{is} eq 'ro') {
- $options->{reader} = $name;
+ $options->{reader} ||= $name;
(!exists $options->{trigger})
|| confess "Cannot have a trigger on a read-only attribute";
}
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Moose;
+
+use Test::More tests => 3;
+
+{
+ package Foo;
+ use Moose;
+ has 'foo' => ( is => 'ro', reader => 'get_foo' );
+}
+
+{
+ my $foo = Foo->new(foo => 10);
+ my $reader = $foo->meta->get_attribute('foo')->reader;
+ is($reader, 'get_foo',
+ 'reader => "get_foo" has correct presedence');
+ can_ok($foo, 'get_foo');
+ is($foo->$reader, 10, "Reader works as expected");
+}
+
+
+
+