From: Shawn M Moore Date: Tue, 17 Jun 2008 02:54:15 +0000 (+0000) Subject: Export and test blessed and confess X-Git-Tag: 0.19~310 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4377514b87240cd2caab82bc09a7ab3f7ba688c3;p=gitmo%2FMouse.git Export and test blessed and confess --- diff --git a/lib/Mouse/Role.pm b/lib/Mouse/Role.pm index 8eeadc9..678d4e9 100644 --- a/lib/Mouse/Role.pm +++ b/lib/Mouse/Role.pm @@ -5,6 +5,7 @@ use warnings; use Sub::Exporter; use Carp 'confess'; +use Scalar::Util; do { my $CALLER; @@ -36,6 +37,12 @@ do { excludes => sub { return sub { } }, + blessed => sub { + return \&Scalar::Util::blessed; + }, + confess => sub { + return \&Carp::confess; + }, ); my $exporter = Sub::Exporter::build_exporter({ diff --git a/t/400-define-role.t b/t/400-define-role.t index 0b3da45..53c77cf 100644 --- a/t/400-define-role.t +++ b/t/400-define-role.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 10; use Test::Exception; lives_ok { @@ -74,3 +74,19 @@ lives_ok { no Mouse::Role; }; +throws_ok { + package Role; + use Mouse::Role; + + confess "Mouse::Role exports confess"; + +} qr/^Mouse::Role exports confess/; + +lives_ok { + package Role; + use Mouse::Role; + + my $obj = bless {} => "Impromptu::Class"; + ::is(blessed($obj), "Impromptu::Class"); +}; +