From: Marcus Ramberg Date: Tue, 18 Apr 2006 13:44:46 +0000 (+0000) Subject: Handle $c->error called as a class method. X-Git-Tag: 5.7099_04~633 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=9ce444302fb0d264c4182d57d564e376e61a4725;hp=4065bc1e439e2fe84ab78901cc9dcbff3906686c Handle $c->error called as a class method. --- diff --git a/Changes b/Changes index 8cd5c71..98c839e 100644 --- a/Changes +++ b/Changes @@ -15,6 +15,7 @@ This file documents the revision history for Perl extension Catalyst. - Applied patch from GEOFFR to allow normal filehandles. - Refactored Dispatcher internals for better readability and speedup (stress tests run 12% faster) + - Allow $c->error to run as a class method 5.66 2006-03-10 17:48:00 - Added Test::WWW::Mechanize::Catalyst support diff --git a/Makefile.PL b/Makefile.PL index 4e366dd..3500fab 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -7,6 +7,7 @@ all_from 'lib/Catalyst.pm'; requires 'perl' => '5.8.1'; requires 'UNIVERSAL::require' => "0.10"; +requires 'Carp'; requires 'Class::Accessor::Fast'; requires 'Class::Data::Inheritable'; requires 'Class::Inspector'; diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 34fd2d0..d756514 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -22,6 +22,7 @@ use Scalar::Util qw/weaken blessed/; use Tree::Simple qw/use_weak_refs/; use Tree::Simple::Visitor::FindByUID; use attributes; +use Carp qw/croak/; __PACKAGE__->mk_accessors( qw/counter request response state action stack namespace/ @@ -298,6 +299,7 @@ sub error { my $c = shift; if ( $_[0] ) { my $error = ref $_[0] eq 'ARRAY' ? $_[0] : [@_]; + croak @$error unless ref $c; push @{ $c->{error} }, @$error; } elsif ( defined $_[0] ) { $c->{error} = undef }