Revision history for Perl extension Moose
+0.17 Tues. Nov. 14, 2006
+ * Moose::Meta::Method::Accessor
+ - bugfix for read-only accessors which
+ are have a type constraint and lazy.
+ Thanks to chansen for finding it.
+
0.16 Tues. Nov. 14, 2006
++ NOTE ++
There are some speed improvements in this release,
t/101_subtype_conflict_bug.t
t/102_Moose_Object_error.t
t/103_subclass_use_base_bug.t
+t/104_inline_reader_bug.t
t/201_example.t
t/202_example_Moose_POOP.t
t/203_example.t
use Carp 'confess';
-our $VERSION = '0.02';
+our $VERSION = '0.03';
use base 'Moose::Meta::Method',
'Class::MOP::Method::Accessor';
. $self->_inline_check_lazy
. 'return ' . $self->_inline_auto_deref( '$_[0]->{$attr_name}' ) . ';'
. '}';
+
+ # NOTE:
+ # set up the environment
+ my $type_constraint = $attr->type_constraint
+ ? $attr->type_constraint->_compiled_type_constraint
+ : undef;
+
my $sub = eval $code;
confess "Could not create reader for '$attr_name' because $@ \n code: $code" if $@;
return $sub;
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+use Test::Exception;
+
+BEGIN {
+ use_ok('Moose');
+}
+
+=pod
+
+This was a bug, but it is fixed now. This
+test makes sure it does not creep back in.
+
+=cut
+
+{
+ package Foo;
+ use Moose;
+
+ ::lives_ok {
+ has 'bar' => (
+ is => 'ro',
+ isa => 'Int',
+ lazy => 1,
+ default => 10,
+ );
+ } '... this didnt die';
+}
+