{{$NEXT}}
+ [BUG FIXES]
+
+ * Don't initialize lazy attributes with defaults in the constructor (for
+ immutable classes). (mo)
+
1.9902-TRIAL Mon, Jan 03, 2011
[OTHER]
# Lazy attrs were never broken, but it doesn't hurt to test that they
# won't be broken by any future changes.
+# Also make sure that attributes stay lazy even after being immutable
+
{
package Bar;
has 'buz' => ( is => 'rw', default => q{"'\\}, lazy => 1 );
has 'faz' => ( is => 'rw', default => qq{\0}, lazy => 1 );
+ {
+ my $bar = Bar->new;
+ ::ok(!$bar->meta->get_attribute($_)->has_value($bar),
+ "Attribute $_ has no value")
+ for qw(foo bar baz buz faz);
+ }
+
::is( ::exception { __PACKAGE__->meta->make_immutable }, undef, 'no errors making a package immutable when it has lazy default values that could break quoting' );
+
+ {
+ my $bar = Bar->new;
+ ::ok(!$bar->meta->get_attribute($_)->has_value($bar),
+ "Attribute $_ has no value (immutable)")
+ for(qw(foo bar baz buz faz));
+ }
+
}
my $bar = Bar->new;