X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FController.pm;h=e1d7d04b8fe2b8f7fdbdf627bb8e2343de049fbe;hb=f0a9b791be61994ae43bd67398fb7eb4d34ea01d;hp=fbc8768a47398b1e64117df6bbbc6f33837fdc3b;hpb=0a2577a8c5e7fd34a7977ea2fc9267f9f888066d;p=catagits%2FCatalyst-Runtime.git 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