Subject: | catalyst server debug mode bug |
Date: | Thu, 24 Feb 2011 11:02:30 -0500 |
To: | bug-Catalyst-Plugin-SubRequest [...] rt.cpan.org |
From: | Carl Pearson <cap10 [...] gwmail.gwu.edu> |
when using the syntax
$c->subreq({ path => ..., }, ... )
the catalyst server will display debugging messages ala
| subrequest: /HASH(0x105badf70) | 0.068083s |
| subrequest: /HASH(0x1065dbc50) | 0.050289s |
| subrequest: /HASH(0x10636d9d0) | 0.046002s |
| subrequest: /HASH(0x1062d0100) | 0.091895s |
instead of "subrequest: /".$path->{path}
to make the reassignment to only occur when debugging, change:
$c->stats->profile( end => 'subrequest: /' . $path ) if ($c->debug);
to
if ($c->debug) {
$path = $path->{path} if (ref $path eq 'HASH');
$c->stats->profile( end => 'subrequest: /' . $path );
}
alternatively, to make the $path change available throughout the sub
(though $path is not currently used elsewhere), change
if (ref $path eq 'HASH') {
@request_mods{keys %$path} = values %$path;
} else {
$request_mods{path} = $path;
}
to reassign the path variable
if (ref $path eq 'HASH') {
@request_mods{keys %$path} = values %$path;
$path = $path->{path};
} else {
$request_mods{path} = $path;
}
this bug occurs with C::P::SubRequest-0.16, perl 5.8.9 (and 5.10.0),
on Darwin 10.6.