[Catalyst-commits] r11860 - in
Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned:
lib lib/Catalyst lib/Catalyst/Engine t t/lib
t/lib/TestAppSimple t/lib/TestAppSimple/Controller
zby at dev.catalyst.perl.org
zby at dev.catalyst.perl.org
Tue Nov 17 07:54:04 GMT 2009
Author: zby
Date: 2009-11-17 07:54:04 +0000 (Tue, 17 Nov 2009)
New Revision: 11860
Added:
Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/t/lib/TestAppSimple.pm
Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/t/lib/TestAppSimple/
Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/t/lib/TestAppSimple/Controller/
Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/t/lib/TestAppSimple/Controller/Root.pm
Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/t/live_simple_app.t
Modified:
Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst.pm
Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst/Context.pm
Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst/Engine.pm
Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst/Engine/CGI.pm
Log:
live serving page in minimal app, plus a new test for that
Modified: Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst/Context.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst/Context.pm 2009-11-17 02:42:23 UTC (rev 11859)
+++ Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst/Context.pm 2009-11-17 07:54:04 UTC (rev 11860)
@@ -3,6 +3,7 @@
use Moose;
use bytes;
use B::Hooks::EndOfScope ();
+use Catalyst;
use Catalyst::Exception::Detach;
use Catalyst::Exception::Go;
use Catalyst::Request;
@@ -42,6 +43,7 @@
debug
dispatcher_class
request_class
+ response_class
dispatcher
prepare
engine_class
@@ -51,7 +53,8 @@
setup_finalize
welcome_message
components
- context_class setup_actions
+ context_class
+ setup_actions
search_extra
root
parse_on_demand
Modified: Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst/Engine/CGI.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst/Engine/CGI.pm 2009-11-17 02:42:23 UTC (rev 11859)
+++ Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst/Engine/CGI.pm 2009-11-17 07:54:04 UTC (rev 11860)
@@ -57,9 +57,9 @@
PROXY_CHECK:
{
- unless ( ref($c)->config->{using_frontend_proxy} ) {
+ unless ( $c->config->{using_frontend_proxy} ) {
last PROXY_CHECK if $ENV{REMOTE_ADDR} ne '127.0.0.1';
- last PROXY_CHECK if ref($c)->config->{ignore_frontend_proxy};
+ last PROXY_CHECK if $c->config->{ignore_frontend_proxy};
}
last PROXY_CHECK unless $ENV{HTTP_X_FORWARDED_FOR};
@@ -126,9 +126,9 @@
# If we are running as a backend proxy, get the true hostname
PROXY_CHECK:
{
- unless ( ref($c)->config->{using_frontend_proxy} ) {
+ unless ( $c->config->{using_frontend_proxy} ) {
last PROXY_CHECK if $host !~ /localhost|127.0.0.1/;
- last PROXY_CHECK if ref($c)->config->{ignore_frontend_proxy};
+ last PROXY_CHECK if $c->config->{ignore_frontend_proxy};
}
last PROXY_CHECK unless $ENV{HTTP_X_FORWARDED_HOST};
Modified: Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst/Engine.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst/Engine.pm 2009-11-17 02:42:23 UTC (rev 11859)
+++ Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst/Engine.pm 2009-11-17 07:54:04 UTC (rev 11860)
@@ -112,7 +112,7 @@
my ( $self, $c ) = @_;
$c->res->content_type('text/html; charset=utf-8');
- my $name = ref($c)->config->{name} || join(' ', split('::', ref $c));
+ my $name = $c->config->{name} || join(' ', split('::', ref $c));
my ( $title, $error, $infos );
if ( $c->debug ) {
@@ -317,14 +317,13 @@
sub prepare_body {
my ( $self, $c ) = @_;
- my $appclass = ref($c) || $c;
if ( my $length = $self->read_length ) {
my $request = $c->request;
unless ( $request->_body ) {
my $type = $request->header('Content-Type');
$request->_body(HTTP::Body->new( $type, $length ));
- $request->_body->tmpdir( $appclass->config->{uploadtmp} )
- if exists $appclass->config->{uploadtmp};
+ $request->_body->tmpdir( $c->config->{uploadtmp} )
+ if exists $c->config->{uploadtmp};
}
while ( my $buffer = $self->read($c) ) {
Modified: Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst.pm 2009-11-17 02:42:23 UTC (rev 11859)
+++ Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/lib/Catalyst.pm 2009-11-17 07:54:04 UTC (rev 11860)
@@ -9,6 +9,7 @@
use Catalyst::Log;
use Catalyst::Utils;
use Catalyst::Controller;
+use Catalyst::Context;
use Devel::InnerPackage ();
use Module::Pluggable::Object ();
use Text::SimpleTable ();
@@ -31,6 +32,7 @@
engine_class context_class request_class response_class stats_class
setup_finished/;
+__PACKAGE__->context_class('Catalyst::Context');
__PACKAGE__->dispatcher_class('Catalyst::Dispatcher');
__PACKAGE__->engine_class('Catalyst::Engine::CGI');
__PACKAGE__->request_class('Catalyst::Request');
@@ -1019,7 +1021,8 @@
# into the application.
$class->context_class( ref $class || $class ) unless $class->context_class;
- my $c = $class->context_class->new({});
+ my $app = $class->new({});
+ my $c = $class->context_class->new( application => $app );
# For on-demand data
$c->request->_context($c);
@@ -1049,7 +1052,7 @@
$c->prepare_read;
# Parse the body unless the user wants it on-demand
- unless ( ref($c)->config->{parse_on_demand} ) {
+ unless ( $app->config->{parse_on_demand} ) {
$c->prepare_body;
}
}
Added: Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/t/lib/TestAppSimple/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/t/lib/TestAppSimple/Controller/Root.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/t/lib/TestAppSimple/Controller/Root.pm 2009-11-17 07:54:04 UTC (rev 11860)
@@ -0,0 +1,18 @@
+package TestAppSimple::Controller::Root;
+use base 'Catalyst::Controller';
+use Scalar::Util ();
+
+__PACKAGE__->config->{namespace} = '';
+
+sub index : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body('root index');
+}
+
+sub some_action : Local {
+ my ( $self, $c ) = @_;
+ $c->res->body('some_action');
+}
+
+
+1;
Added: Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/t/lib/TestAppSimple.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/t/lib/TestAppSimple.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/t/lib/TestAppSimple.pm 2009-11-17 07:54:04 UTC (rev 11860)
@@ -0,0 +1,21 @@
+use strict;
+use warnings;
+
+package TestAppSimple;
+
+use Catalyst qw/
+ Test::MangleDollarUnderScore
+ Test::Errors
+ Test::Headers
+ Test::Plugin
+/;
+
+our $VERSION = '0.01';
+
+__PACKAGE__->config( name => 'TestAppStats', root => '/some/dir' );
+
+__PACKAGE__->setup;
+
+1;
+
+
Added: Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/t/live_simple_app.t
===================================================================
--- Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/t/live_simple_app.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/basic-app-ctx-separation-cleaned/t/live_simple_app.t 2009-11-17 07:54:04 UTC (rev 11860)
@@ -0,0 +1,12 @@
+use FindBin;
+use lib "$FindBin::Bin/lib";
+use Catalyst::Test 'TestAppSimple', {default_host => 'default.com'};
+use Catalyst::Request;
+
+use Test::More;
+
+content_like('/',qr/root/,'root check');
+#content_like('/some_action',qr/some_action/,'some_action check');
+
+done_testing;
+
More information about the Catalyst-commits
mailing list