- A trigger now receives the old value as a second argument, if
the attribute had one.
+ * Moose::Meta::Method::Constructor
+ - Fix a bug with $obj->new when $obj has stringify overloading.
+ Reported by Andrew Suffield [rt.cpan.org #47882] (Sartak)
+
0.88 Fri Jul 24, 2009
* Moose::Manual::Contributing
- Re-write the Moose::Manual::Contributing document to reflect
# requires some adaption on the part of
# the author, after all, nothing is free)
my $source = 'sub {';
- $source .= "\n" . 'my $class = shift;';
+ $source .= "\n" . 'my $_instance = shift;';
+ $source .= "\n" . 'my $class = Scalar::Util::blessed($_instance) || $_instance;';
$source .= "\n" . 'return $class->Moose::Object::new(@_)';
$source .= "\n if \$class ne '" . $self->associated_metaclass->name
--- /dev/null
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+{
+ package Foo;
+
+ use Moose;
+
+ use overload '""' => sub {''};
+
+ sub bug { 'plenty' }
+
+ __PACKAGE__->meta->make_immutable;
+}
+
+ok(Foo->new()->bug(), 'call constructor on object reference with overloading');
+