[Catalyst-commits] r10162 - in Catalyst-Plugin-RunAfterRequest/trunk: lib/Catalyst/Model/Role lib/Catalyst/Plugin t/lib/TestApp/Model

evdb at dev.catalyst.perl.org evdb at dev.catalyst.perl.org
Thu May 14 20:13:27 GMT 2009


Author: evdb
Date: 2009-05-14 20:13:27 +0000 (Thu, 14 May 2009)
New Revision: 10162

Modified:
   Catalyst-Plugin-RunAfterRequest/trunk/lib/Catalyst/Model/Role/RunAfterRequest.pm
   Catalyst-Plugin-RunAfterRequest/trunk/lib/Catalyst/Plugin/RunAfterRequest.pm
   Catalyst-Plugin-RunAfterRequest/trunk/t/lib/TestApp/Model/Foo.pm
Log:
rename the method in the model so that it is 'private' and explain reasoning in the POD 

Modified: Catalyst-Plugin-RunAfterRequest/trunk/lib/Catalyst/Model/Role/RunAfterRequest.pm
===================================================================
--- Catalyst-Plugin-RunAfterRequest/trunk/lib/Catalyst/Model/Role/RunAfterRequest.pm	2009-05-14 20:00:21 UTC (rev 10161)
+++ Catalyst-Plugin-RunAfterRequest/trunk/lib/Catalyst/Model/Role/RunAfterRequest.pm	2009-05-14 20:13:27 UTC (rev 10162)
@@ -12,7 +12,7 @@
     bless( { %$self, _context => $c }, ref($self) );
 }
 
-sub run_after_request {
+sub _run_after_request {
     my $self = shift;
     $self->_context->run_after_request(@_);
 }

Modified: Catalyst-Plugin-RunAfterRequest/trunk/lib/Catalyst/Plugin/RunAfterRequest.pm
===================================================================
--- Catalyst-Plugin-RunAfterRequest/trunk/lib/Catalyst/Plugin/RunAfterRequest.pm	2009-05-14 20:00:21 UTC (rev 10161)
+++ Catalyst-Plugin-RunAfterRequest/trunk/lib/Catalyst/Plugin/RunAfterRequest.pm	2009-05-14 20:13:27 UTC (rev 10162)
@@ -58,7 +58,7 @@
     sub some_method {
         my $self = shift;
 
-        $self->run_after_request(
+        $self->_run_after_request(
             sub { $self->do_something_slow(); },
             sub { $self->do_something_else_as_well(); }
         );
@@ -78,7 +78,7 @@
 
 =head2 run_after_request
 
-    $c->run_after_request(
+    $c->run_after_request(            # '_run_after_request' in model
         sub { 
             # create preview of uploaded file and store to remote server
             # etc, etc
@@ -91,6 +91,10 @@
 Takes one or more anonymous subs and adds them to a list to be run after the
 response has been sent back to the client.
 
+The method name has an underscore at the start in the model to indicate that it
+is a private method. Really you should only be calling this method from within
+the model and not from other code.
+
 =head1 AUTHOR
 
 Matt S Trout (mst) <mst at shadowcat.co.uk>

Modified: Catalyst-Plugin-RunAfterRequest/trunk/t/lib/TestApp/Model/Foo.pm
===================================================================
--- Catalyst-Plugin-RunAfterRequest/trunk/t/lib/TestApp/Model/Foo.pm	2009-05-14 20:00:21 UTC (rev 10161)
+++ Catalyst-Plugin-RunAfterRequest/trunk/t/lib/TestApp/Model/Foo.pm	2009-05-14 20:13:27 UTC (rev 10162)
@@ -10,7 +10,7 @@
 
 sub demonstrate {
     my $self = shift;
-    $self->run_after_request(
+    $self->_run_after_request(
         sub { push( @data, "one" ); },
         sub { push( @data, "two" ); },
         sub { push @data, ref shift },




More information about the Catalyst-commits mailing list