[Catalyst-commits] r12747 - trunk/Catalyst-Plugin-UploadProgress/lib/Catalyst/Plugin

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Thu Jan 28 00:00:34 GMT 2010


Author: t0m
Date: 2010-01-28 00:00:34 +0000 (Thu, 28 Jan 2010)
New Revision: 12747

Modified:
   trunk/Catalyst-Plugin-UploadProgress/lib/Catalyst/Plugin/UploadProgress.pm
Log:
Patch from RT#53870

Modified: trunk/Catalyst-Plugin-UploadProgress/lib/Catalyst/Plugin/UploadProgress.pm
===================================================================
--- trunk/Catalyst-Plugin-UploadProgress/lib/Catalyst/Plugin/UploadProgress.pm	2010-01-27 21:04:17 UTC (rev 12746)
+++ trunk/Catalyst-Plugin-UploadProgress/lib/Catalyst/Plugin/UploadProgress.pm	2010-01-28 00:00:34 UTC (rev 12747)
@@ -2,11 +2,12 @@
 
 use strict;
 use warnings;
-use NEXT;
+use Moose;
 
 our $VERSION = '0.05';
 
-sub prepare_body_chunk {
+# I'm concerned that this doesn't call super() at all..
+ override 'prepare_body_chunk' => sub {
     my ( $c, $chunk ) = @_;
     
     my $body = $c->request->{_body};
@@ -33,9 +34,9 @@
             $c->cache->set( 'upload_progress_' . $id, $progress );
         }
     }
-}
+};
 
-sub prepare_body {
+override 'prepare_body' => sub {
     my $c = shift;
     
     # Detect if the user stopped the upload, prepare_body will die with an invalid
@@ -49,7 +50,7 @@
             $croaked = shift;
         };
         
-        $c->NEXT::prepare_body(@_);
+        super;
     }
     
     if ( $croaked ) {
@@ -67,9 +68,9 @@
         # rethrow the error
         Catalyst::Exception->throw( $croaked );
     }
-}
+};
 
-sub dispatch {
+override 'dispatch' => sub {
     my $c = shift;
     
     # if the URI query string is ?progress_id=<id> intercept the request
@@ -79,20 +80,18 @@
         return $c->upload_progress_output( $1 );
     }
     
-    return $c->NEXT::ACTUAL::dispatch(@_);
-}
+    return super;
+};
 
-sub setup {
+after 'setup' => sub {
     my $c = shift;
             
-    $c->NEXT::setup(@_);
-    
     unless ( $c->can('cache') ) {
         Catalyst::Exception->throw(
             message => 'UploadProgress requires a cache plugin.'
         );
     }
-}
+};
 
 sub upload_progress {
     my ( $c, $upload_id ) = @_;
@@ -283,6 +282,9 @@
 
 Andy Grundman, <andy at hybridized.org>
 
+NEXT to Moose::Role conversion by Toby Corkindale, <tjc at cpan.org>, blame him
+for any faults there..
+
 =head1 THANKS
 
 The authors of L<Apache2::UploadProgress>, for the progress.js and
@@ -296,4 +298,4 @@
 This program is free software, you can redistribute it and/or modify it under
 the same terms as Perl itself.
 
-=cut
\ No newline at end of file
+=cut




More information about the Catalyst-commits mailing list