r12983@zaphod: kd | 2008-04-28 18:10:27 +1000
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / CGI.pm
index 75b8fba..7cd01dd 100644 (file)
@@ -41,7 +41,7 @@ sub finalize_headers {
 
     $c->response->header( Status => $c->response->status );
 
-    $self->{_header_buf}
+    $self->{_header_buf} 
         = $c->response->headers->as_string("\015\012") . "\015\012";
 }
 
@@ -139,21 +139,21 @@ sub prepare_path {
     # set the request URI
     my $path = $base_path . ( $ENV{PATH_INFO} || '' );
     $path =~ s{^/+}{};
-
+    
     # Using URI directly is way too slow, so we construct the URLs manually
     my $uri_class = "URI::$scheme";
-
+    
     # HTTP_HOST will include the port even if it's 80/443
     $host =~ s/:(?:80|443)$//;
-
+    
     if ( $port !~ /^(?:80|443)$/ && $host !~ /:/ ) {
         $host .= ":$port";
     }
-
+    
     # Escape the path
     $path =~ s/([^$URI::uric])/$URI::Escape::escapes{$1}/go;
     $path =~ s/\?/%3F/g; # STUPID STUPID SPECIAL CASE
-
+    
     my $query = $ENV{QUERY_STRING} ? '?' . $ENV{QUERY_STRING} : '';
     my $uri   = $scheme . '://' . $host . '/' . $path . $query;
 
@@ -162,7 +162,7 @@ sub prepare_path {
     # set the base URI
     # base must end in a slash
     $base_path .= '/' unless $base_path =~ m{/$};
-
+    
     my $base_uri = $scheme . '://' . $host . $base_path;
 
     $c->request->base( bless \$base_uri, $uri_class );
@@ -200,8 +200,9 @@ Enable autoflush on the output handle for CGI-based engines.
 
 =cut
 
-before prepare_write => sub {
+around prepare_write => sub {
     *STDOUT->autoflush(1);
+    return shift->(@_);
 };
 
 =head2 $self->write($c, $buffer)
@@ -236,15 +237,11 @@ sub run { shift; shift->handle_request(@_) }
 
 =head1 SEE ALSO
 
-L<Catalyst> L<Catalyst::Engine>.
+L<Catalyst>, L<Catalyst::Engine>
 
 =head1 AUTHORS
 
-Sebastian Riedel, <sri@cpan.org>
-
-Christian Hansen, <ch@ngmedia.com>
-
-Andy Grundman, <andy@hybridized.org>
+Catalyst Contributors, see Catalyst.pm
 
 =head1 COPYRIGHT
 
@@ -252,5 +249,6 @@ This program is free software, you can redistribute it and/or modify it under
 the same terms as Perl itself.
 
 =cut
+no Moose;
 
 1;