=head1 SYNOPSIS
+Path part matching, allowing several actions to sequentially take care of processing a request:
+
# root action - captures one argument after it
sub foo_setup : Chained('/') PathPart('foo') CaptureArgs(1) {
my ( $self, $c, $foo_arg ) = @_;
=head1 DESCRIPTION
-See L</USAGE>.
+Dispatch type managing default behaviour. For more information on
+dispatch types, see:
+
+=over 4
+
+=item * L<Catalyst::Manual::Intro> for how they affect application authors
+
+=item * L<Catalyst::DispatchType> for implementation information.
+
+=back
=head1 METHODS
my $has_unattached_actions;
my $unattached_actions = Text::SimpleTable->new(
- [ 35, 'Private' ], [ 36, 'Missing parent' ],
+ [ 35, 'Private' ], [ $column_width, 'Missing parent' ],
);
ENDPOINT: foreach my $endpoint (
}
if ($parent ne '/') {
$has_unattached_actions = 1;
- $unattached_actions->row('/'.$parents[0]->reverse, $parent);
+ $unattached_actions->row('/' . ($parents[0] || $endpoint)->reverse, $parent);
next ENDPOINT;
}
my @rows;
push(@rows, [ '', $name ]);
}
push(@rows, [ '', (@rows ? "=> " : '')."/${endpoint}" ]);
- $rows[0][0] = join('/', '', @parts);
+ $rows[0][0] = join('/', '', @parts) || '/';
$paths->row(@$_) for @rows;
}
"Multiple Chained attributes not supported registering ${action}"
);
}
+ my $chained_to = $chained_attr[0];
- my $children = ($self->_children_of->{ $chained_attr[0] } ||= {});
+ Catalyst::Exception->throw(
+ "Actions cannot chain to themselves registering /${action}"
+ ) if ($chained_to eq '/' . $action);
+
+ my $children = ($self->_children_of->{ $chained_to } ||= {});
my @path_part = @{ $action->attributes->{PathPart} || [] };
return undef if @captures; # fail for too many captures
return join('/', '', @parts);
-
+
}
=head2 $c->expand_action($action)