X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FBase.pm;h=2a6672b308e75ec51c650b43f3a3d90754271027;hb=5400c668d8f1629c468fabd8c13e9ad3f7f71375;hp=dd930382aff298fb52e94f0b2c4be9f6d4c8dd83;hpb=361d12347d56a10aeb237240f15336b0d835a5b3;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Base.pm b/lib/Catalyst/Base.pm index dd93038..2a6672b 100644 --- a/lib/Catalyst/Base.pm +++ b/lib/Catalyst/Base.pm @@ -8,12 +8,10 @@ use Catalyst::Utils; use Class::Inspector; use NEXT; -__PACKAGE__->mk_classdata($_) for qw/_dispatch_steps/; +__PACKAGE__->mk_classdata($_) for qw/_dispatch_steps _action_class/; __PACKAGE__->_dispatch_steps( [qw/_BEGIN _AUTO _ACTION/] ); - -# Fix for stupid components -*new = \&Catalyst::Component::new; +__PACKAGE__->_action_class('Catalyst::Action'); sub _DISPATCH : Private { my ( $self, $c ) = @_; @@ -57,6 +55,26 @@ sub _END : Private { return !@{ $c->error }; } +=head1 NAME + +Catalyst::Base - Catalyst Base Class + +=head1 SYNOPSIS + +See L + +=head1 DESCRIPTION + +Catalyst Base Class + +=head1 METHODS + +=over 4 + +=item $self->action_namespace($c) + +=cut + sub action_namespace { my ( $self, $c ) = @_; return Catalyst::Utils::class2prefix( ref $self, @@ -64,6 +82,10 @@ sub action_namespace { || ''; } +=item $self->register_actions($c) + +=cut + sub register_actions { my ( $self, $c ) = @_; my $class = ref $self || $self; @@ -95,7 +117,7 @@ sub register_actions { next; } my $reverse = $namespace ? "$namespace/$method" : $method; - my $action = Catalyst::Action->new( + my $action = $self->_action_class->new( { name => $method, code => $code, @@ -116,7 +138,8 @@ sub _parse_attrs { # Parse out :Foo(bar) into Foo => bar etc (and arrayify) - if ( my ( $key, $value ) = ( $attr =~ /^(.*?)(?:\(\s*(.+)\s*\))?$/ ) ) { + if ( my ( $key, $value ) = ( $attr =~ /^(.*?)(?:\(\s*(.+?)\s*\))?$/ ) ) + { if ( defined $value ) { ( $value =~ s/^'(.*)'$/$1/ ) || ( $value =~ s/^"(.*)"/$1/ ); @@ -127,25 +150,11 @@ sub _parse_attrs { return \%attributes; } -=head1 NAME - -Catalyst::Base - Catalyst Controller Base Class - -=head1 SYNOPSIS - - -=head1 DESCRIPTION - - -=head1 METHODS - -=over 4 - =back =head1 SEE ALSO -L. +L, L. =head1 AUTHOR