start using Class::C3, may need to add a reinitalize bit later, not sure
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / CGI.pm
index ae5a652..5a09064 100644 (file)
@@ -1,10 +1,13 @@
 package Catalyst::Engine::CGI;
 
+use Class::C3;
 use Moose;
 extends 'Catalyst::Engine';
 
 has env => (is => 'rw');
 
+no Moose;
+
 =head1 NAME
 
 Catalyst::Engine::CGI - The CGI Engine
@@ -172,15 +175,14 @@ sub prepare_path {
 
 =cut
 
-around prepare_query_parameters => sub {
-    my $orig = shift;
+sub prepare_query_parameters {
     my ( $self, $c ) = @_;
     local (*ENV) = $self->env || \%ENV;
 
     if ( $ENV{QUERY_STRING} ) {
-        $self->$orig( $c, $ENV{QUERY_STRING} );
+        $self->next::method( $c, $ENV{QUERY_STRING} );
     }
-};
+}
 
 =head2 $self->prepare_request($c, (env => \%env))
 
@@ -200,9 +202,10 @@ Enable autoflush on the output handle for CGI-based engines.
 
 =cut
 
-before prepare_write => sub {
+sub prepare_write {
     *STDOUT->autoflush(1);
-};
+    return shift->next::method(@_);
+}
 
 =head2 $self->write($c, $buffer)
 
@@ -210,8 +213,7 @@ Writes the buffer to the client.
 
 =cut
 
-around write => sub {
-    my $orig = shift;
+sub write {
     my ( $self, $c, $buffer ) = @_;
 
     # Prepend the headers if they have not yet been sent
@@ -219,8 +221,8 @@ around write => sub {
         $buffer = $headers . $buffer;
     }
 
-    return $self->$orig( $c, $buffer );
-};
+    return $self->next::method( $c, $buffer );
+}
 
 =head2 $self->read_chunk($c, $buffer, $length)