[Catalyst-commits] r13169 - in Catalyst-Runtime/5.80/trunk: lib
lib/Catalyst t/lib
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Mon Apr 19 02:40:24 GMT 2010
Author: t0m
Date: 2010-04-19 03:40:24 +0100 (Mon, 19 Apr 2010)
New Revision: 13169
Modified:
Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm
Catalyst-Runtime/5.80/trunk/t/lib/TestApp.pm
Log:
Document the action config here, as people don't seem to find it and this may help..
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm 2010-04-19 02:02:36 UTC (rev 13168)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm 2010-04-19 02:40:24 UTC (rev 13169)
@@ -446,11 +446,31 @@
Sets 'path_prefix', as described below.
+=head2 action
+
+Allows you to set the attributes that the dispatcher creates actions out of.
+This allows you to do 'rails style routes', or override some of the
+attribute defintions of actions composed from Roles.
+You can set arguments globally (for all actions of the controller) and
+specifically (for a single action).
+
+ __PACKAGE__->config(
+ action => {
+ '*' => { Chained => 'base', Args => 0 },
+ base => { Chained => '/', PathPart => '', CaptureArgs => 0 },
+ },
+ );
+
+In the case above every sub in the package would be made into a Chain
+endpoint with a URI the same as the sub name for each sub, chained
+to the sub named C<base>. Ergo dispatch to C</example> would call the
+C<base> method, then the C<example> method.
+
=head2 action_args
Allows you to set constructor arguments on your actions. You can set arguments
-globally (for all actions of the controller) and specifically (for a single
-action). This is particularly useful when using C<ActionRole>s
+globally and specifically (as above).
+This is particularly useful when using C<ActionRole>s
(L<Catalyst::Controller::ActionRole>) and custom C<ActionClass>es.
__PACKAGE__->config(
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2010-04-19 02:02:36 UTC (rev 13168)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2010-04-19 02:40:24 UTC (rev 13169)
@@ -2408,10 +2408,6 @@
# we know M::P::O found a file on disk so this is safe
Catalyst::Utils::ensure_class_loaded( $component, { ignore_loaded => 1 } );
-
- # Needs to be done as soon as the component is loaded, as loading a sub-component
- # (next time round the loop) can cause us to get the wrong metaclass..
- $class->_controller_init_base_classes($component);
}
for my $component (@comps) {
@@ -2421,7 +2417,6 @@
: $class->expand_component_module( $component, $config );
for my $component (@expanded_components) {
next if $comps{$component};
- $class->_controller_init_base_classes($component); # Also cover inner packages
$class->components->{ $component } = $class->setup_component($component);
}
}
@@ -2474,19 +2469,6 @@
=cut
-# FIXME - Ugly, ugly hack to ensure the we force initialize non-moose base classes
-# nearest to Catalyst::Controller first, no matter what order stuff happens
-# to be loaded. There are TODO tests in Moose for this, see
-# f2391d17574eff81d911b97be15ea51080500003
-sub _controller_init_base_classes {
- my ($app_class, $component) = @_;
- return unless $component->isa('Catalyst::Controller');
- foreach my $class ( reverse @{ mro::get_linear_isa($component) } ) {
- Moose::Meta::Class->initialize( $class )
- unless find_meta($class);
- }
-}
-
sub setup_component {
my( $class, $component ) = @_;
Modified: Catalyst-Runtime/5.80/trunk/t/lib/TestApp.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestApp.pm 2010-04-19 02:02:36 UTC (rev 13168)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestApp.pm 2010-04-19 02:40:24 UTC (rev 13169)
@@ -20,6 +20,11 @@
TestApp->config( name => 'TestApp', root => '/some/dir' );
+# Test bug found when re-adjusting the metaclass compat code in Moose
+# in 292360. Test added to Moose in 4b760d6, but leave this attribute
+# above ->setup so we have some generated methods to be double sure.
+has an_attribute_before_we_change_base_classes => ( is => 'ro');
+
if ($::setup_leakchecker && eval { Class::MOP::load_class('CatalystX::LeakChecker'); 1 }) {
with 'CatalystX::LeakChecker';
More information about the Catalyst-commits
mailing list