sub composed_request_class {
my $class = shift;
+ return $class->_composed_request_class if $class->_composed_request_class;
+
my @traits = (@{$class->request_class_traits||[]}, @{$class->config->{request_class_traits}||[]});
# For each trait listed, figure out what the namespace is. First we try the $trait
Class::Load::load_first_existing_class($_, $class.'::'.$trait_ns.'::'. $_, 'Catalyst::'.$trait_ns.'::'.$_)
} @traits;
- return $class->_composed_request_class ||
- $class->_composed_request_class(Moose::Util::with_traits($class->request_class, @normalized_traits));
+ if ($class->debug && scalar(@normalized_traits)) {
+ my $column_width = Catalyst::Utils::term_width() - 6;
+ my $t = Text::SimpleTable->new($column_width);
+ $t->row($_) for @normalized_traits;
+ $class->log->debug( "Composed Request Class Traits:\n" . $t->draw . "\n" );
+ }
+
+ return $class->_composed_request_class(Moose::Util::with_traits($class->request_class, @normalized_traits));
}
has response => (
sub composed_response_class {
my $class = shift;
+ return $class->_composed_response_class if $class->_composed_response_class;
+
my @traits = (@{$class->response_class_traits||[]}, @{$class->config->{response_class_traits}||[]});
my $trait_ns = 'TraitFor::Response';
Class::Load::load_first_existing_class($_, $class.'::'.$trait_ns.'::'. $_, 'Catalyst::'.$trait_ns.'::'.$_)
} @traits;
- return $class->_composed_response_class ||
- $class->_composed_response_class(Moose::Util::with_traits($class->response_class, @normalized_traits));
+ if ($class->debug && scalar(@normalized_traits)) {
+ my $column_width = Catalyst::Utils::term_width() - 6;
+ my $t = Text::SimpleTable->new($column_width);
+ $t->row($_) for @normalized_traits;
+ $class->log->debug( "Composed Response Class Traits:\n" . $t->draw . "\n" );
+ }
+
+ return $class->_composed_response_class(Moose::Util::with_traits($class->response_class, @normalized_traits));
}
has namespace => (is => 'rw');
sub composed_stats_class {
my $class = shift;
+ return $class->_composed_stats_class if $class->_composed_stats_class;
+
my @traits = (@{$class->stats_class_traits||[]}, @{$class->config->{stats_class_traits}||[]});
my $trait_ns = 'TraitFor::Stats';
Class::Load::load_first_existing_class($_, $class.'::'.$trait_ns.'::'. $_, 'Catalyst::'.$trait_ns.'::'.$_)
} @traits;
- return $class->_composed_stats_class ||
- $class->_composed_stats_class(Moose::Util::with_traits($class->stats_class, @normalized_traits));
+ if ($class->debug && scalar(@normalized_traits)) {
+ my $column_width = Catalyst::Utils::term_width() - 6;
+ my $t = Text::SimpleTable->new($column_width);
+ $t->row($_) for @normalized_traits;
+ $class->log->debug( "Composed Stats Class Traits:\n" . $t->draw . "\n" );
+ }
+
+ return $class->_composed_stats_class(Moose::Util::with_traits($class->stats_class, @normalized_traits));
}
__PACKAGE__->_encode_check(Encode::FB_CROAK | Encode::LEAVE_SRC);
# Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.90101';
+our $VERSION = '5.90104';
$VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev releases
sub import {
return $c->{error} || [];
}
-
=head2 $c->state
Contains the return value of the last executed action.
Note that << $c->state >> operates in a scalar context which means that all
values it returns are scalar.
+Please note that if an action throws an exception, the value of state
+should no longer be considered the return if the last action. It is generally
+going to be 0, which indicates an error state. Examine $c->error for error
+details.
+
=head2 $c->clear_errors
Clear errors. You probably don't want to clear the errors unless you are
$class->setup_encoding();
$class->setup_middleware();
+ # call these so we pre setup the composed classes
+ $class->composed_request_class;
+ $class->composed_response_class;
+ $class->composed_stats_class;
+
# Initialize our data structure
$class->components( {} );
sub execute {
my ( $c, $class, $code ) = @_;
$class = $c->component($class) || $class;
- $c->state(0);
+ #$c->state(0);
if ( $c->depth >= $RECURSION ) {
my $action = $code->reverse();
}
$c->error($error);
}
- $c->state(0);
+ #$c->state(0);
}
return $c->state;
}
my $c = $class->context_class->new({ $uploadtmp ? (_uploadtmp => $uploadtmp) : ()});
$c->response->_context($c);
-
$c->stats($class->stats_class->new)->enable($c->use_stats);
if ( $c->debug || $c->config->{enable_catalyst_header} ) {
chansen: Christian Hansen
+Chase Venters C<chase.venters@gmail.com>
+
chicks: Christopher Hicks
Chisel Wright C<pause@herlpacker.co.uk>