=== modified file 'lib/Struct/Dumb.pm'
--- lib/Struct/Dumb.pm 2015-10-06 21:24:25 +0000
+++ lib/Struct/Dumb.pm 2015-10-06 21:33:45 +0000
@@ -157,9 +157,10 @@
: sub { shift->[$idx] };
}
$subs{DESTROY} = sub {};
- $subs{AUTOLOAD} = sub {
+ $subs{AUTOLOAD} = sub :lvalue {
my ( $field ) = our $AUTOLOAD =~ m/::([^:]+)$/;
croak "$pkg does not have a '$field' field";
+ my $dummy; ## croak can't be last because it isn't lvalue, so this line is required
};
my $constructor;
=== modified file 't/01point.t'
--- t/01point.t 2015-10-06 21:24:25 +0000
+++ t/01point.t 2015-10-06 21:33:45 +0000
@@ -24,6 +24,10 @@
qr/^main::Point does not have a 'z' field at \S+ line \d+\.?\n/,
'$point->z throws exception' );
+like( exception { $point->z = 40 },
+ qr/^main::Point does not have a 'z' field at \S+ line \d+\.?\n/,
+ '$point->z :lvalue throws exception' );
+
like( exception { Point(30) },
qr/^usage: main::Point\(\$x, \$y\) at \S+ line \d+\.?\n/,
'Point(30) throws usage exception' );