From: John Napiorkowski Date: Wed, 16 Jun 2010 19:55:08 +0000 (+0000) Subject: broke out and documented action_class method X-Git-Tag: 5.80025~2^2~4^2~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=f0a9b791be61994ae43bd67398fb7eb4d34ea01d broke out and documented action_class method --- diff --git a/lib/Catalyst/Controller.pm b/lib/Catalyst/Controller.pm index fbc8768..e1d7d04 100644 --- a/lib/Catalyst/Controller.pm +++ b/lib/Catalyst/Controller.pm @@ -248,16 +248,25 @@ sub register_action_methods { } } -sub create_action { +sub action_class { my $self = shift; my %args = @_; my $class = (exists $args{attributes}{ActionClass} - ? $args{attributes}{ActionClass}[0] - : $self->_action_class); + ? $args{attributes}{ActionClass}[0] + : $self->_action_class); + Class::MOP::load_class($class); + return $class; +} + +sub create_action { + my $self = shift; + my %args = @_; + my $class = $self->action_class(%args); my $action_args = $self->config->{action_args}; + my %extra_args = ( %{ $action_args->{'*'} || {} }, %{ $action_args->{ $args{name} } || {} }, @@ -529,6 +538,11 @@ action methods for this package. Creates action objects for a set of action methods using C< create_action >, and registers them with the dispatcher. +=head2 $self->action_class(%args) + +Used when a controller is creating an action to determine the correct base +action class to use. + =head2 $self->create_action(%args) Called with a hash of data to be use for construction of a new