X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=43bda89bf208ce9ac059db8880c3dd4c905fdc88;hb=0eb98ebd1624e8181a4bd88c26605f2a0f1c91d7;hp=571f260664ce9e7cce20a2a424d8b06a4f01b205;hpb=7c1c4dc69062bd372f6611c5a2d3e054cf777d79;p=catagits%2FCatalyst-Runtime.git
diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm
index 571f260..43bda89 100644
--- a/lib/Catalyst.pm
+++ b/lib/Catalyst.pm
@@ -4,7 +4,7 @@ use Moose;
use Moose::Meta::Class ();
extends 'Catalyst::Component';
use Moose::Util qw/find_meta/;
-use B::Hooks::EndOfScope ();
+use namespace::clean -except => 'meta';
use Catalyst::Exception;
use Catalyst::Exception::Detach;
use Catalyst::Exception::Go;
@@ -23,6 +23,7 @@ use Path::Class::File ();
use URI ();
use URI::http;
use URI::https;
+use HTML::Entities;
use Tree::Simple qw/use_weak_refs/;
use Tree::Simple::Visitor::FindByUID;
use Class::C3::Adopt::NEXT;
@@ -33,12 +34,14 @@ use Catalyst::EngineLoader;
use utf8;
use Carp qw/croak carp shortmess/;
use Try::Tiny;
+use Safe::Isa;
use Plack::Middleware::Conditional;
use Plack::Middleware::ReverseProxy;
use Plack::Middleware::IIS6ScriptNameFix;
+use Plack::Middleware::IIS7KeepAliveFix;
use Plack::Middleware::LighttpdScriptNameFix;
-BEGIN { require 5.008004; }
+BEGIN { require 5.008003; }
has stack => (is => 'ro', default => sub { [] });
has stash => (is => 'rw', default => sub { {} });
@@ -50,20 +53,30 @@ has request => (
is => 'rw',
default => sub {
my $self = shift;
- my %p = ( _log => $self->log );
- $p{_uploadtmp} = $self->_uploadtmp if $self->_has_uploadtmp;
- $self->request_class->new(\%p);
+ $self->request_class->new($self->_build_request_constructor_args);
},
lazy => 1,
);
+sub _build_request_constructor_args {
+ my $self = shift;
+ my %p = ( _log => $self->log );
+ $p{_uploadtmp} = $self->_uploadtmp if $self->_has_uploadtmp;
+ \%p;
+}
+
has response => (
is => 'rw',
default => sub {
my $self = shift;
- $self->response_class->new({ _log => $self->log });
+ $self->response_class->new($self->_build_response_constructor_args);
},
lazy => 1,
);
+sub _build_response_constructor_args {
+ my $self = shift;
+ { _log => $self->log };
+}
+
has namespace => (is => 'rw');
sub depth { scalar @{ shift->stack || [] }; }
@@ -100,7 +113,7 @@ __PACKAGE__->stats_class('Catalyst::Stats');
# Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.90006';
+our $VERSION = '5.90020';
sub import {
my ( $class, @arguments ) = @_;
@@ -135,6 +148,8 @@ sub import {
sub _application { $_[0] }
+=encoding UTF-8
+
=head1 NAME
Catalyst - The Elegant MVC Web Application Framework
@@ -372,8 +387,12 @@ When called with no arguments it escapes the processing chain entirely.
sub detach { my $c = shift; $c->dispatcher->detach( $c, @_ ) }
+=head2 $c->visit( $action [, \@arguments ] )
+
=head2 $c->visit( $action [, \@captures, \@arguments ] )
+=head2 $c->visit( $class, $method, [, \@arguments ] )
+
=head2 $c->visit( $class, $method, [, \@captures, \@arguments ] )
Almost the same as L<< forward|/"$c->forward( $action [, \@arguments ] )" >>,
@@ -402,8 +421,12 @@ transfer control to another action as if it had been reached directly from a URL
sub visit { my $c = shift; $c->dispatcher->visit( $c, @_ ) }
+=head2 $c->go( $action [, \@arguments ] )
+
=head2 $c->go( $action [, \@captures, \@arguments ] )
+=head2 $c->go( $class, $method, [, \@arguments ] )
+
=head2 $c->go( $class, $method, [, \@captures, \@arguments ] )
The relationship between C
If you want to jump right into web development with Catalyst you might want to start with a tutorial.
-perldoc Catalyst::Manual::Tutorial +perldoc Catalyst::Manual::TutorialAfterwards you can go on to check out a more complete look at our features.
-perldoc Catalyst::Manual::Intro +
perldoc Catalyst::Manual::Intro
What to do next?
Next it's time to write an actual application. Use the - helper scripts to generate controllers, - models, and - views; + helper scripts to generate controllers, + models, and + views; they can save you a lot of work.
script/${prefix}_create.pl --help
Also, be sure to check out the vast and growing @@ -1803,7 +1803,7 @@ sub finalize { $c->finalize_error; } - $c->finalize_headers; + $c->finalize_headers unless $c->response->finalized_headers; # HEAD request if ( $c->request->method eq 'HEAD' ) { @@ -1870,6 +1870,7 @@ sub finalize_headers { if ( !$response->has_body ) { # Add a default body if none is already present + my $encoded_location = encode_entities($location); $response->body(<<"EOF"); @@ -1877,7 +1878,7 @@ sub finalize_headers {
Moved -This item has moved here.
+This item has moved here.