# Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.7011';
+our $VERSION = '5.7013';
sub import {
my ( $class, @arguments ) = @_;
contain GET parameter key/value pairs, which will be appended to the URI
in standard fashion.
+Note that uri_for is destructive to the passed hashref. Subsequent calls
+with the same hashref may have unintended results.
+
Instead of C<$path>, you can also optionally pass a C<$action> object
which will be resolved to a path using
C<< $c->dispatcher->uri_for_action >>; if the first element of
$val = '' unless defined $val;
(map {
$_ = "$_";
- utf8::encode( $_ );
+ utf8::encode( $_ ) if utf8::is_utf8($_);
# using the URI::Escape pattern here so utf8 chars survive
s/([^A-Za-z0-9\-_.!~*'() ])/$URI::Escape::escapes{$1}/go;
s/ /+/g;
}
}
+ my $uid = "$code" . $c->counter->{"$code"};
+
# is this a root-level call or a forwarded call?
if ( $callsub =~ /forward$/ ) {
# forward, locate the caller
if ( my $parent = $c->stack->[-1] ) {
- $c->stats->profile(begin => $action,
- parent => "$parent" . $c->counter->{"$parent"});
+ $c->stats->profile(
+ begin => $action,
+ parent => "$parent" . $c->counter->{"$parent"},
+ uid => $uid,
+ );
}
else {
# forward with no caller may come from a plugin
- $c->stats->profile(begin => $action);
+ $c->stats->profile(
+ begin => $action,
+ uid => $uid,
+ );
}
}
else {
-
+
# root-level call
- $c->stats->profile(begin => $action);
+ $c->stats->profile(
+ begin => $action,
+ uid => $uid,
+ );
}
return $action;
sub _stats_finish_execute {
my ( $c, $info ) = @_;
- $c->stats->profile(end => $info);
+ $c->stats->profile( end => $info );
}
=head2 $c->_localize_fields( sub { }, \%keys );
$c->finalize_body;
}
- if ($c->use_stats) {
- my $elapsed = tv_interval($c->stats->getNodeValue);
+ if ($c->use_stats) {
+ my $elapsed = sprintf '%f', $c->stats->elapsed;
my $av = $elapsed == 0 ? '??' : sprintf '%.3f', 1 / $elapsed;
$c->log->info(
"Request took ${elapsed}s ($av/s)\n" . $c->stats->report . "\n" );
}
}
else {
+ # everything should be bytes at this point, but just in case
$c->response->content_length( bytes::length( $c->response->body ) );
}
}
my $env = Catalyst::Utils::env_value( $class, 'STATS' );
if ( defined($env) ? $env : ($stats || $class->debug ) ) {
- no strict 'refs';
- *{"$class\::use_stats"} = sub { 1 };
- $class->log->debug('Statistics enabled');
+ no strict 'refs';
+ *{"$class\::use_stats"} = sub { 1 };
+ $class->log->debug('Statistics enabled');
}
}