X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=9fee7bea2b22b0686d5cd6f0981d9a14ffcc5dcb;hp=8d59a4d1f1517096e437926a33c23e8f8bf3b96f;hb=3cec521ae07b2d779f88adab532f791ad42c8676;hpb=684d10edf63074f94667d437db01d30b8d13cefc diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 8d59a4d..9fee7be 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -44,7 +44,13 @@ require Module::Pluggable::Fast; our $CATALYST_SCRIPT_GEN = 10; __PACKAGE__->mk_classdata($_) - for qw/components arguments dispatcher engine log/; + for qw/components arguments dispatcher engine log dispatcher_class + engine_class context_class request_class response_class/; + +__PACKAGE__->dispatcher_class('Catalyst::Dispatcher'); +__PACKAGE__->engine_class('Catalyst::Engine::CGI'); +__PACKAGE__->request_class('Catalyst::Request'); +__PACKAGE__->response_class('Catalyst::Response'); our $VERSION = '5.49_03'; @@ -415,7 +421,7 @@ sub setup { $class->setup_components; if ( $class->debug ) { - my $t = Text::SimpleTable->new( [ 37, 'Class' ], [ 36, 'Type' ] ); + my $t = Text::SimpleTable->new( [ 65, 'Class' ], [ 8, 'Type' ] ); for my $comp ( sort keys %{ $class->components } ) { my $type = ref $class->components->{$comp} ? 'instance' : 'class'; $t->row( $comp, $type ); @@ -1061,33 +1067,36 @@ into a Catalyst context . sub prepare { my ( $class, @arguments ) = @_; - my $c = bless { - counter => {}, - depth => 0, - request => Catalyst::Request->new( - { - arguments => [], - body_parameters => {}, - cookies => {}, - headers => HTTP::Headers->new, - parameters => {}, - query_parameters => {}, - secure => 0, - snippets => [], - uploads => {} - } - ), - response => Catalyst::Response->new( - { - body => '', - cookies => {}, - headers => HTTP::Headers->new(), - status => 200 - } - ), - stash => {}, - state => 0 - }, $class; + $class->context_class( ref $class || $class ) unless $class->context_class; + my $c = $class->context_class->new( + { + counter => {}, + depth => 0, + request => $class->request_class->new( + { + arguments => [], + body_parameters => {}, + cookies => {}, + headers => HTTP::Headers->new, + parameters => {}, + query_parameters => {}, + secure => 0, + snippets => [], + uploads => {} + } + ), + response => $class->response_class->new( + { + body => '', + cookies => {}, + headers => HTTP::Headers->new(), + status => 200 + } + ), + stash => {}, + state => 0 + } + ); # For on-demand data $c->request->{_context} = $c; @@ -1426,7 +1435,7 @@ sub setup_dispatcher { } unless ($dispatcher) { - $dispatcher = 'Catalyst::Dispatcher'; + $dispatcher = $class->dispatcher_class; } $dispatcher->require; @@ -1515,7 +1524,7 @@ sub setup_engine { } unless ($engine) { - $engine = 'Catalyst::Engine::CGI'; + $engine = $class->engine_class; } $engine->require;