From: Florian Ragwitz Date: Tue, 15 Sep 2009 19:18:00 +0000 (+0000) Subject: Use MooseX::Role::WithOverloading. X-Git-Tag: 5.80014~10^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=80e287baec94d765da86c3f208e8590a2b568060 Use MooseX::Role::WithOverloading. --- diff --git a/Makefile.PL b/Makefile.PL index 6fae99a..fcf057e 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -21,6 +21,7 @@ requires 'MooseX::Emulate::Class::Accessor::Fast' => '0.00801'; requires 'Class::MOP' => '0.83'; requires 'Moose' => '0.78'; requires 'MooseX::MethodAttributes::Inheritable' => '0.15'; +requires 'MooseX::Role::WithOverloading'; requires 'Carp'; requires 'Class::C3::Adopt::NEXT' => '0.07'; requires 'CGI::Simple::Cookie'; diff --git a/lib/Catalyst/Exception/Basic.pm b/lib/Catalyst/Exception/Basic.pm index 7d963e8..6530a6f 100644 --- a/lib/Catalyst/Exception/Basic.pm +++ b/lib/Catalyst/Exception/Basic.pm @@ -1,6 +1,6 @@ package Catalyst::Exception::Basic; -use Moose::Role; +use MooseX::Role::WithOverloading; use Carp; use namespace::clean -except => 'meta'; @@ -12,10 +12,6 @@ has message => ( default => sub { $! || '' }, ); -use overload - q{""} => \&as_string, - fallback => 1; - sub as_string { my ($self) = @_; return $self->message; diff --git a/lib/Catalyst/Exception/Interface.pm b/lib/Catalyst/Exception/Interface.pm index 1bd603a..9b9c421 100644 --- a/lib/Catalyst/Exception/Interface.pm +++ b/lib/Catalyst/Exception/Interface.pm @@ -1,7 +1,11 @@ package Catalyst::Exception::Interface; -use Moose::Role; -use namespace::autoclean; +use MooseX::Role::WithOverloading; +use namespace::clean -except => 'meta'; + +use overload + q{""} => sub { $_[0]->as_string }, + fallback => 1; requires qw/as_string throw rethrow/; diff --git a/t/custom_exception_class_simple.t b/t/custom_exception_class_simple.t index e87ed80..8c8c0c2 100644 --- a/t/custom_exception_class_simple.t +++ b/t/custom_exception_class_simple.t @@ -7,12 +7,6 @@ use lib "$Bin/lib"; use Test::More tests => 1; use Test::Exception; -TODO: { - local $TODO = 'Does not work yet'; - lives_ok { require TestAppClassExceptionSimpleTest; } 'Can load application'; - -} -