X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=b751ba322561678c8c96a28b0be23dd1bfb6bf00;hb=d91474f509dab7dce4c3e4328e674ab9fea29284;hp=aa8215c324803d14d0ad0f61e2ddd3a2da852771;hpb=91772de91ca26edab67f5849eccbfbbe0d2cfd51;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index aa8215c..b751ba3 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -16,8 +16,9 @@ use Scalar::Util (); has read_length => (is => 'rw'); has read_position => (is => 'rw'); -# Stringify to class -use overload '""' => sub { return ref shift }, fallback => 1; +has _prepared_write => (is => 'rw'); + +no Moose; # Amount of data to read from input on each pass our $CHUNKSIZE = 64 * 1024; @@ -97,7 +98,7 @@ sub finalize_cookies { =head2 $self->finalize_error($c) -Output an apropriate error message, called if there's an error in $c +Output an appropriate error message. Called if there's an error in $c after the dispatch has finished. Will output debug messages if Catalyst is in debug mode, or a `please come back later` message otherwise. @@ -124,15 +125,12 @@ sub finalize_error { $name = "

$name

"; # Don't show context in the dump - delete $c->req->{_context}; - delete $c->res->{_context}; + $c->req->_clear_context; + $c->res->_clear_context; # Don't show body parser in the dump delete $c->req->{_body}; - # Don't show response header state in dump - delete $c->res->{_finalized_headers}; - my @infos; my $i = 0; for my $dump ( $c->dump_these ) { @@ -160,6 +158,7 @@ EOF (no) Vennligst prov igjen senere (dk) Venligst prov igen senere (pl) Prosze sprobowac pozniej +(pt) Por favor volte mais tarde $name = ''; @@ -317,7 +316,7 @@ sub prepare_body { unless ( $request->{_body} ) { my $type = $request->header('Content-Type'); $request->{_body} = HTTP::Body->new( $type, $length ); - $request->{_body}->{tmpdir} = $c->config->{uploadtmp} + $request->{_body}->tmpdir( $c->config->{uploadtmp} ) if exists $c->config->{uploadtmp}; } @@ -454,7 +453,7 @@ sub prepare_query_parameters { # replace semi-colons $query_string =~ s/;/&/g; - my @params = split /&/, $query_string; + my @params = grep { length $_ } split /&/, $query_string; for my $item ( @params ) { @@ -621,11 +620,13 @@ Writes the buffer to the client. sub write { my ( $self, $c, $buffer ) = @_; - unless ( $self->{_prepared_write} ) { + unless ( $self->_prepared_write ) { $self->prepare_write($c); - $self->{_prepared_write} = 1; + $self->_prepared_write(1); } + return 0 if !defined $buffer; + my $len = length($buffer); my $wrote = syswrite STDOUT, $buffer; @@ -674,9 +675,7 @@ sub unescape_uri { =head1 AUTHORS -Sebastian Riedel, - -Andy Grundman, +Catalyst Contributors, see Catalyst.pm =head1 COPYRIGHT