Merge branch 'master' into exception_interface
Florian Ragwitz [Tue, 15 Sep 2009 19:17:41 +0000 (19:17 +0000)]
master: (112 commits)
The warning about a class having mutable ancestors has been removed (and was never in a non-dev Moose release)
Work with old and new Moose
Preserve immutable_options when temporarily making a class mutable
Rework the C<< $c->go >> documentation a little, hopefully it's more clear.
Blargh. Merge branch deprecate_appclass_actions manually, with svn merge http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Runtime/5.80/trunk http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Runtime/5.80/branches/deprecate_appclass_actions . after I forgot -l on svk push, but ctrl-C after the first rev meant svk had already committed a merge mark and re-merging did nothing, and removing it didn't do the right thing. Fail cake..
Eat the merge mark, svk hates me.

Fix warnings in upcoming moose
add myself to contributors
Prepare for release
un-TODO passing TODO tests
Fix duplicate results from get_action_methods. Q. Why didn't I just do that first time round? A: Am idiot.
AGH. Too tired to be doing this, fucked it up again
I'm an idiot, that totally doesn't work. remove.
Test for r11331 + fix to only report each action name once from get_action_methods
Fix hash key name back to what it used to be for compat, keeping renamed accessor where it was. Tests for this breakage to follow
Changelogging
Changes tweaks
Bump versions back to 5.8.4
Changelog
...

lib/Catalyst/Exception.pm
lib/Catalyst/Exception/Basic.pm [new file with mode: 0644]
lib/Catalyst/Exception/Detach.pm
lib/Catalyst/Exception/Go.pm
lib/Catalyst/Exception/Interface.pm [new file with mode: 0644]

index c8d5547..7506483 100644 (file)
@@ -2,12 +2,6 @@ package Catalyst::Exception;
 
 # XXX: See bottom of file for Exception implementation
 
-package Catalyst::Exception::Base;
-
-use Moose;
-use Carp;
-use namespace::clean -except => 'meta';
-
 =head1 NAME
 
 Catalyst::Exception - Catalyst Exception Class
@@ -32,48 +26,6 @@ This is the Catalyst Exception class.
 
 Throws a fatal exception.
 
-=cut
-
-has message => (
-    is      => 'ro',
-    isa     => 'Str',
-    default => sub { $! || '' },
-);
-
-use overload
-    q{""}    => \&as_string,
-    fallback => 1;
-
-sub as_string {
-    my ($self) = @_;
-    return $self->message;
-}
-
-around BUILDARGS => sub {
-    my ($next, $class, @args) = @_;
-    if (@args == 1 && !ref $args[0]) {
-        @args = (message => $args[0]);
-    }
-
-    my $args = $class->$next(@args);
-    $args->{message} ||= $args->{error}
-        if exists $args->{error};
-
-    return $args;
-};
-
-sub throw {
-    my $class = shift;
-    my $error = $class->new(@_);
-    local $Carp::CarpLevel = 1;
-    croak $error;
-}
-
-sub rethrow {
-    my ($self) = @_;
-    croak $self;
-}
-
 =head2 meta
 
 Provided by Moose
@@ -89,19 +41,30 @@ it under the same terms as Perl itself.
 
 =cut
 
-Catalyst::Exception::Base->meta->make_immutable;
-
-package Catalyst::Exception;
+{
+    package Catalyst::Exception::Base;
 
-use Moose;
-use namespace::clean -except => 'meta';
+    use Moose;
+    use namespace::clean -except => 'meta';
 
-use vars qw[$CATALYST_EXCEPTION_CLASS];
+    with 'Catalyst::Exception::Basic';
 
-BEGIN {
-    extends($CATALYST_EXCEPTION_CLASS || 'Catalyst::Exception::Base');
+    __PACKAGE__->meta->make_immutable;
 }
 
-__PACKAGE__->meta->make_immutable;
+{
+    package Catalyst::Exception;
+
+    use Moose;
+    use namespace::clean -except => 'meta';
+
+    use vars qw[$CATALYST_EXCEPTION_CLASS];
+
+    BEGIN {
+        extends($CATALYST_EXCEPTION_CLASS || 'Catalyst::Exception::Base');
+    }
+
+    __PACKAGE__->meta->make_immutable;
+}
 
 1;
diff --git a/lib/Catalyst/Exception/Basic.pm b/lib/Catalyst/Exception/Basic.pm
new file mode 100644 (file)
index 0000000..7d963e8
--- /dev/null
@@ -0,0 +1,49 @@
+package Catalyst::Exception::Basic;
+
+use Moose::Role;
+use Carp;
+use namespace::clean -except => 'meta';
+
+with 'Catalyst::Exception::Interface';
+
+has message => (
+    is      => 'ro',
+    isa     => 'Str',
+    default => sub { $! || '' },
+);
+
+use overload
+    q{""}    => \&as_string,
+    fallback => 1;
+
+sub as_string {
+    my ($self) = @_;
+    return $self->message;
+}
+
+around BUILDARGS => sub {
+    my ($next, $class, @args) = @_;
+    if (@args == 1 && !ref $args[0]) {
+        @args = (message => $args[0]);
+    }
+
+    my $args = $class->$next(@args);
+    $args->{message} ||= $args->{error}
+        if exists $args->{error};
+
+    return $args;
+};
+
+sub throw {
+    my $class = shift;
+    my $error = $class->new(@_);
+    local $Carp::CarpLevel = 1;
+    croak $error;
+}
+
+sub rethrow {
+    my ($self) = @_;
+    croak $self;
+}
+
+1;
index 5f98119..926243d 100644 (file)
@@ -3,7 +3,7 @@ package Catalyst::Exception::Detach;
 use Moose;
 use namespace::clean -except => 'meta';
 
-extends 'Catalyst::Exception';
+with 'Catalyst::Exception::Basic';
 
 has '+message' => (
     default => "catalyst_detach\n",
index 6be9efe..50e416c 100644 (file)
@@ -3,7 +3,7 @@ package Catalyst::Exception::Go;
 use Moose;
 use namespace::clean -except => 'meta';
 
-extends 'Catalyst::Exception';
+with 'Catalyst::Exception::Basic';
 
 has '+message' => (
     default => "catalyst_go\n",
diff --git a/lib/Catalyst/Exception/Interface.pm b/lib/Catalyst/Exception/Interface.pm
new file mode 100644 (file)
index 0000000..1bd603a
--- /dev/null
@@ -0,0 +1,8 @@
+package Catalyst::Exception::Interface;
+
+use Moose::Role;
+use namespace::autoclean;
+
+requires qw/as_string throw rethrow/;
+
+1;