# Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.80021';
-our $PRETTY_VERSION = $VERSION;
-
-$VERSION = eval $VERSION;
+our $VERSION = '5.80022';
sub import {
my ( $class, @arguments ) = @_;
if ( $class->debug ) {
my $name = $class->config->{name} || 'Application';
- $class->log->info("$name powered by Catalyst $Catalyst::PRETTY_VERSION");
+ $class->log->info("$name powered by Catalyst $Catalyst::VERSION");
}
# Make sure that the application class becomes immutable at this point,
#surely this is not the most efficient way to do things...
$c->stats($class->stats_class->new)->enable($c->use_stats);
- if ( $c->debug ) {
+ if ( $c->debug || $c->config->{enable_catalyst_header} ) {
$c->res->headers->header( 'X-Catalyst' => $Catalyst::VERSION );
}
=head2 $c->log_response
-Writes information about the response to the debug logs. This includes:
+Writes information about the response to the debug logs by calling
+C<< $c->log_response_status_line >> and C<< $c->log_response_headers >>.
+
+=cut
+
+sub log_response {
+ my $c = shift;
+
+ return unless $c->debug;
+
+ my($dump) = grep {$_->[0] eq 'Response' } $c->dump_these;
+ my $response = $dump->[1];
+
+ $c->log_response_status_line($response);
+ $c->log_response_headers($response->headers);
+}
+
+=head2 $c->log_response_status_line($response)
+
+Writes one line of information about the response to the debug logs. This includes:
=over 4
=cut
-sub log_response {
- my $c = shift;
-
- return unless $c->debug;
-
- my($dump) = grep {$_->[0] eq 'Response' } $c->dump_these;
- my $response = $dump->[1];
+sub log_response_status_line {
+ my ($c, $response) = @_;
$c->log->debug(
sprintf(
);
}
+=head2 $c->log_response_headers($headers);
+
+Hook method which can be wrapped by plugins to log the responseheaders.
+No-op in the default implementation.
+
+=cut
+
+sub log_response_headers {}
+
=head2 $c->log_request_parameters( query => {}, body => {} )
Logs request parameters to debug logs
return unless $c->debug;
- my $t = Text::SimpleTable->new( [ 35, 'Header Name' ], [ 40, 'Value' ] );
+ my $column_width = Catalyst::Utils::term_width() - 28;
+ my $t = Text::SimpleTable->new( [ 15, 'Header Name' ], [ $column_width, 'Value' ] );
$headers->scan(
sub {
my ( $name, $value ) = @_;
if $plugin->isa( 'Catalyst::Component' );
$proto->_plugins->{$plugin} = 1;
unless ($instant) {
- no strict 'refs';
- if ( my $meta = Class::MOP::get_metaclass_by_name($class) ) {
- my @superclasses = ($plugin, $meta->superclasses );
- $meta->superclasses(@superclasses);
- } else {
- unshift @{"$class\::ISA"}, $plugin;
- }
+ my $meta = Class::MOP::get_metaclass_by_name($class);
+ $meta->superclasses($plugin, $meta->superclasses);
}
return $class;
}