From: Florian Ragwitz Date: Mon, 15 Sep 2008 16:02:27 +0000 (+0000) Subject: Display unattached chained actions under -Debug. X-Git-Tag: 5.8000_03~56 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=007a7ca0e2c93f24d55019aaedf27121f91b8cbc Display unattached chained actions under -Debug. --- diff --git a/lib/Catalyst/DispatchType/Chained.pm b/lib/Catalyst/DispatchType/Chained.pm index a7d08a3..a27f6ba 100644 --- a/lib/Catalyst/DispatchType/Chained.pm +++ b/lib/Catalyst/DispatchType/Chained.pm @@ -71,6 +71,11 @@ sub list { [ 35, 'Path Spec' ], [ 36, 'Private' ] ); + my $has_unattached_actions; + my $unattached_actions = Text::SimpleTable->new( + [ 35, 'Private' ], [ 36, 'Missing parent' ], + ); + ENDPOINT: foreach my $endpoint ( sort { $a->reverse cmp $b->reverse } @{ $self->_endpoints } @@ -92,7 +97,11 @@ sub list { $curr = $self->_actions->{$parent}; unshift(@parents, $curr) if $curr; } - next ENDPOINT unless $parent eq '/'; # skip dangling action + if ($parent ne '/') { + $has_unattached_actions = 1; + $unattached_actions->row('/'.$parents[0]->reverse, $parent); + next ENDPOINT; + } my @rows; foreach my $p (@parents) { my $name = "/${p}"; @@ -110,6 +119,8 @@ sub list { } $c->log->debug( "Loaded Chained actions:\n" . $paths->draw . "\n" ); + $c->log->debug( "Unattached Chained actions:\n", $unattached_actions->draw . "\n" ) + if $has_unattached_actions; } =head2 $self->match( $c, $path )