From: Matt S Trout Date: Thu, 22 Jun 2006 14:51:25 +0000 (+0000) Subject: tweaked ChildOf debug output X-Git-Tag: 5.7099_04~496 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=d34667c3f70fc4cbc4c79292bdd305283c2fa603 tweaked ChildOf debug output r10054@cain (orig r4391): matthewt | 2006-06-17 15:50:43 +0000 --- diff --git a/lib/Catalyst/DispatchType/ChildOf.pm b/lib/Catalyst/DispatchType/ChildOf.pm index 1719483..9b58d85 100644 --- a/lib/Catalyst/DispatchType/ChildOf.pm +++ b/lib/Catalyst/DispatchType/ChildOf.pm @@ -41,6 +41,7 @@ sub list { ) { my $args = $endpoint->attributes->{Args}->[0]; my @parts = (defined($args) ? (("*") x $args) : '...'); + my @parents = (); my $parent = "DUMMY"; my $curr = $endpoint; while ($curr) { @@ -53,9 +54,23 @@ sub list { } $parent = $curr->attributes->{ChildOf}->[0]; $curr = $self->{actions}{$parent}; + unshift(@parents, $curr) if $curr; } next ENDPOINT unless $parent eq '/'; # skip dangling action - $paths->row(join('/', '', @parts), "/$endpoint"); + my @rows; + foreach my $p (@parents) { + my $name = "/${p}"; + if (my $cap = $p->attributes->{Captures}) { + $name .= ' ('.$cap->[0].')'; + } + unless ($p eq $parents[0]) { + $name = "-> ${name}"; + } + push(@rows, [ '', $name ]); + } + push(@rows, [ '', (@rows ? "=> " : '')."/${endpoint}" ]); + $rows[0][0] = join('/', '', @parts); + $paths->row(@$_) for @rows; } $c->log->debug( "Loaded Path Part actions:\n" . $paths->draw );