X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=4cf485d0e99a0685744f7dab227f139c86aef751;hp=b6196354fb4129f372f25f3f46ca9a9c0fabc5b3;hb=cc95842fedcac58b2dc12c6ce547e22d3170351c;hpb=88879e92d58519c320438f8440a68d1648f4c099
diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm
index b619635..4cf485d 100644
--- a/lib/Catalyst.pm
+++ b/lib/Catalyst.pm
@@ -61,7 +61,7 @@ __PACKAGE__->response_class('Catalyst::Response');
# Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.7001';
+our $VERSION = '5.7006';
sub import {
my ( $class, @arguments ) = @_;
@@ -92,11 +92,12 @@ Catalyst - The Elegant MVC Web Application Framework
catalyst.pl MyApp
# add models, views, controllers
- script/myapp_create.pl model Database DBIC::SchemaLoader dbi:SQLite:/path/to/db
- script/myapp_create.pl view TT TT
+ script/myapp_create.pl model MyDatabase DBIC::Schema create=dynamic dbi:SQLite:/path/to/db
+ script/myapp_create.pl view MyTemplate TT
script/myapp_create.pl controller Search
# built in testserver -- use -r to restart automatically on changes
+ # --help to see all available options
script/myapp_server.pl
# command line testing interface
@@ -224,6 +225,12 @@ Forces Catalyst to use a specific home directory, e.g.:
use Catalyst qw[-Home=/usr/mst];
+This can also be done in the shell environment by setting either the
+C
Welcome to the wonderful world of Catalyst.
+ Welcome to the world of Catalyst.
This MVC
framework will make web development something you had
never expected it to be: Fun, rewarding, and quick. That really depends on what you want to do.
We do, however, provide you with a few starting points. If you want to jump right into web development with Catalyst
- you might want to check out the documentation.
+ you might want want to start with a tutorial.perldoc Catalyst::Manual::Intro
-perldoc Catalyst::Manual::Tutorial
-perldoc Catalyst::Manual
perldoc Catalyst::Manual::Tutorial ++
Afterwards you can go on to check out a more complete look at our features.
+
+perldoc Catalyst::Manual::Intro
+
+
Next it's time to write an actual application. Use the
helper scripts to generate controllers,
@@ -1289,6 +1326,24 @@ sub finalize {
$c->finalize_body;
}
+
+ if ($c->debug) {
+ my $elapsed = sprintf '%f', tv_interval($c->stats->getNodeValue);
+ my $av = sprintf '%.3f', ( $elapsed == 0 ? '??' : ( 1 / $elapsed ) );
+
+ my $t = Text::SimpleTable->new( [ 62, 'Action' ], [ 9, 'Time' ] );
+ $c->stats->traverse(
+ sub {
+ my $action = shift;
+ my $stat = $action->getNodeValue;
+ $t->row( ( q{ } x $action->getDepth ) . $stat->{action} . $stat->{comment},
+ $stat->{elapsed} || '??' );
+ }
+ );
+
+ $c->log->info(
+ "Request took ${elapsed}s ($av/s)\n" . $t->draw . "\n" );
+ }
return $c->response->status;
}
@@ -1417,35 +1472,15 @@ sub handle_request {
my $status = -1;
eval {
if ($class->debug) {
- my $start = [gettimeofday];
- my $c = $class->prepare(@arguments);
- $c->stats(Tree::Simple->new);
- $c->dispatch;
- $status = $c->finalize;
-
- my $elapsed = tv_interval $start;
- $elapsed = sprintf '%f', $elapsed;
- my $av = sprintf '%.3f',
- ( $elapsed == 0 ? '??' : ( 1 / $elapsed ) );
- my $t = Text::SimpleTable->new( [ 62, 'Action' ], [ 9, 'Time' ] );
-
- $c->stats->traverse(
- sub {
- my $action = shift;
- my $stat = $action->getNodeValue;
- $t->row( ( q{ } x $action->getDepth ) . $stat->{action} . $stat->{comment},
- $stat->{elapsed} || '??' );
- }
- );
-
- $class->log->info(
- "Request took ${elapsed}s ($av/s)\n" . $t->draw );
- }
- else {
- my $c = $class->prepare(@arguments);
- $c->dispatch;
- $status = $c->finalize;
+ my $secs = time - $START || 1;
+ my $av = sprintf '%.3f', $COUNT / $secs;
+ my $time = localtime time;
+ $class->log->info("*** Request $COUNT ($av/s) [$$] [$time] ***");
}
+
+ my $c = $class->prepare(@arguments);
+ $c->dispatch;
+ $status = $c->finalize;
};
if ( my $error = $@ ) {
@@ -1499,20 +1534,17 @@ sub prepare {
}
);
+ if ( $c->debug ) {
+ $c->stats(Tree::Simple->new([gettimeofday]));
+ $c->res->headers->header( 'X-Catalyst' => $Catalyst::VERSION );
+ }
+
# For on-demand data
$c->request->{_context} = $c;
$c->response->{_context} = $c;
weaken( $c->request->{_context} );
weaken( $c->response->{_context} );
- if ( $c->debug ) {
- my $secs = time - $START || 1;
- my $av = sprintf '%.3f', $COUNT / $secs;
- my $time = localtime time;
- $c->log->info("*** Request $COUNT ($av/s) [$$] [$time] ***");
- $c->res->headers->header( 'X-Catalyst' => $Catalyst::VERSION );
- }
-
# Allow engine to direct the prepare flow (for POE)
if ( $c->engine->can('prepare') ) {
$c->engine->prepare( $c, @arguments );
@@ -1738,7 +1770,7 @@ Reads a chunk of data from the request body. This method is designed to
be used in a while loop, reading C<$maxlength> bytes on every call.
C<$maxlength> defaults to the size of the request if not specified.
-You have to set C