From: Stevan Little Date: Sat, 22 Mar 2008 15:41:19 +0000 (+0000) Subject: moving stuff around a bit X-Git-Tag: 0_55~265 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bad76b8eedcf4bc6f4fb2a3a478f73a08b1b1603;p=gitmo%2FMoose.git moving stuff around a bit --- diff --git a/lib/Moose/Meta/Method/Constructor.pm b/lib/Moose/Meta/Method/Constructor.pm index cbb767e..6fa9719 100644 --- a/lib/Moose/Meta/Method/Constructor.pm +++ b/lib/Moose/Meta/Method/Constructor.pm @@ -7,7 +7,7 @@ use warnings; use Carp 'confess'; use Scalar::Util 'blessed', 'weaken', 'looks_like_number'; -our $VERSION = '0.08'; +our $VERSION = '0.09'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Method', @@ -178,8 +178,9 @@ sub _generate_slot_initializer { ('$type_constraints[' . $index . ']'), '$val' ) if ($is_moose && $attr->has_type_constraint); + push @source => $self->_generate_slot_assignment($attr, '$val', $index); - push @source => '}'; # close - wrap this to avoid my $val overwrite warnings + push @source => '}'; # close - wrap this to avoid my $val overrite warnings push @source => "}" if defined $attr->init_arg; } diff --git a/t/300_immutable/007_immutable_default.t b/t/100_bugs/010_immutable_n_default_x2.t similarity index 82% rename from t/300_immutable/007_immutable_default.t rename to t/100_bugs/010_immutable_n_default_x2.t index bee24ef..e5d3b19 100644 --- a/t/300_immutable/007_immutable_default.t +++ b/t/100_bugs/010_immutable_n_default_x2.t @@ -3,7 +3,11 @@ use strict; use warnings; -use Test::More tests => 2; +use Test::More tests => 3; + +BEGIN { + use_ok('Moose'); +} { package Foo; @@ -14,7 +18,7 @@ use Test::More tests => 2; has foo => ( is => 'rw', isa => 'Str', - default => sub { use Devel::StackTrace; warn Devel::StackTrace->new;$foo_default_called++; 'foo' }, + default => sub { $foo_default_called++; 'foo' }, ); our $bar_default_called = 0;