[Catalyst-commits] r11817 -
Catalyst-Runtime/5.80/branches/action_args/lib/Catalyst
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Fri Nov 13 14:49:56 GMT 2009
Author: rafl
Date: 2009-11-13 14:49:54 +0000 (Fri, 13 Nov 2009)
New Revision: 11817
Modified:
Catalyst-Runtime/5.80/branches/action_args/lib/Catalyst/Controller.pm
Log:
Allow passing extra args to action constructors using action_args config.
Modified: Catalyst-Runtime/5.80/branches/action_args/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/action_args/lib/Catalyst/Controller.pm 2009-11-13 14:49:21 UTC (rev 11816)
+++ Catalyst-Runtime/5.80/branches/action_args/lib/Catalyst/Controller.pm 2009-11-13 14:49:54 UTC (rev 11817)
@@ -255,9 +255,15 @@
my $class = (exists $args{attributes}{ActionClass}
? $args{attributes}{ActionClass}[0]
: $self->_action_class);
+ Class::MOP::load_class($class);
- Class::MOP::load_class($class);
- return $class->new( \%args );
+ my $action_args = $self->config->{action_args};
+ my %extra_args = (
+ %{ $action_args->{'*'} || {} },
+ %{ $action_args->{ $args{name} } || {} },
+ );
+
+ return $class->new({ %extra_args, %args });
}
sub _parse_attrs {
More information about the Catalyst-commits
mailing list