From: Yuval Kogman Date: Sun, 5 Jul 2009 22:52:54 +0000 (-0500) Subject: Laxen the error condition for delegation methods X-Git-Tag: 0.87~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2cc6f9825ee943b379068b9e9d4938bbc84e0308;p=gitmo%2FMoose.git Laxen the error condition for delegation methods This allows class names to be used as delegates --- diff --git a/lib/Moose/Meta/Method/Delegation.pm b/lib/Moose/Meta/Method/Delegation.pm index 1118b1e..88ea1fa 100644 --- a/lib/Moose/Meta/Method/Delegation.pm +++ b/lib/Moose/Meta/Method/Delegation.pm @@ -81,9 +81,9 @@ sub _initialize_body { my $proxy = $instance->$accessor(); my $error - = !defined $proxy ? ' is not defined' - : !blessed $proxy ? qq{ is not an object (got '$proxy')} - : undef; + = !defined $proxy ? ' is not defined' + : ref($proxy) && !blessed($proxy) ? qq{ is not an object (got '$proxy')} + : undef; if ($error) { $self->throw_error(