From: Shawn M Moore Date: Fri, 27 Jun 2008 04:27:50 +0000 (+0000) Subject: Better error message for clone_instance("foo") X-Git-Tag: 0.19~267 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e42bee44a43a31f5271f0e4aa1b670dc41775160;p=gitmo%2FMouse.git Better error message for clone_instance("foo") --- diff --git a/lib/Mouse/Meta/Class.pm b/lib/Mouse/Meta/Class.pm index 96da88f..bf3276a 100644 --- a/lib/Mouse/Meta/Class.pm +++ b/lib/Mouse/Meta/Class.pm @@ -98,7 +98,7 @@ sub clone_instance { my ($class, $instance, %params) = @_; (blessed($instance)) - || confess "You can only clone instances, \$self is not a blessed instance"; + || confess "You can only clone instances, ($instance) is not a blessed instance"; my $clone = bless { %$instance }, ref $instance; diff --git a/t/031-clone.t b/t/031-clone.t index fd9e500..9d7454f 100644 --- a/t/031-clone.t +++ b/t/031-clone.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 9; +use Test::More tests => 10; use Test::Exception; do { @@ -57,3 +57,7 @@ throws_ok { Foo->meta->clone_object(Foo->meta) } qr/You must pass an instance of the metaclass \(Foo\), not \(Mo.se::Meta::Class=HASH\(\w+\)\)/; +throws_ok { + Foo->meta->clone_instance("constant") +} qr/You can only clone instances, \(constant\) is not a blessed instance/; +