[Catalyst-commits] r7765 - in Catalyst-Runtime/5.80/branches/moose: lib lib/Catalyst lib/Catalyst/DispatchType t t/lib

konobi at dev.catalyst.perl.org konobi at dev.catalyst.perl.org
Tue May 20 09:11:56 BST 2008


Author: konobi
Date: 2008-05-20 09:11:55 +0100 (Tue, 20 May 2008)
New Revision: 7765

Modified:
   Catalyst-Runtime/5.80/branches/moose/lib/Catalyst.pm
   Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Action.pm
   Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionChain.pm
   Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionContainer.pm
   Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Chained.pm
   Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Dispatcher.pm
   Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine.pm
   Catalyst-Runtime/5.80/branches/moose/t/lib/TestApp.pm
   Catalyst-Runtime/5.80/branches/moose/t/lib/TestAppDoubleAutoBug.pm
   Catalyst-Runtime/5.80/branches/moose/t/live_stats.t
Log:
Remove use of overload
  * Fixup some tests
  * Fixup some areas of code


Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Action.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Action.pm	2008-05-19 23:32:41 UTC (rev 7764)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Action.pm	2008-05-20 08:11:55 UTC (rev 7765)
@@ -33,19 +33,6 @@
 
 #__PACKAGE__->mk_accessors(qw/class namespace reverse attributes name code/);
 
-use overload (
-
-    # Stringify to reverse for debug output etc.
-    q{""} => sub { shift->reverse() },
-
-    # Codulate to execute to invoke the encapsulated action coderef
-    '&{}' => sub { my $self = shift; sub { $self->execute(@_); }; },
-
-    # Make general $stuff still work
-    fallback => 1,
-
-);
-
 sub dispatch {    # Execute ourselves against a context
     my ( $self, $c ) = @_;
     #Moose todo: grrrrrr. this is no good. i don't know enough about it to

Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionChain.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionChain.pm	2008-05-19 23:32:41 UTC (rev 7764)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionChain.pm	2008-05-20 08:11:55 UTC (rev 7765)
@@ -24,20 +24,6 @@
 
 =cut
 
-use overload (
-
-    # Stringify to reverse for debug output etc.
-    q{""} => sub { shift->{reverse} },
-
-    # Codulate to execute to invoke the encapsulated action coderef
-    '&{}' => sub { my $self = shift; sub { $self->execute(@_); }; },
-
-    # Make general $stuff still work
-    fallback => 1,
-
-);
-
-
 sub dispatch {
     my ( $self, $c ) = @_;
     my @captures = @{$c->req->captures||[]};

Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionContainer.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionContainer.pm	2008-05-19 23:32:41 UTC (rev 7764)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionContainer.pm	2008-05-20 08:11:55 UTC (rev 7765)
@@ -18,13 +18,6 @@
 use Class::C3;
 use Moose;
 
-use overload (
-
-    # Stringify to path part for tree search
-    q{""} => sub { shift->part },
-
-);
-
 has part => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
 has actions => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
 

Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Chained.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Chained.pm	2008-05-19 23:32:41 UTC (rev 7764)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Chained.pm	2008-05-20 08:11:55 UTC (rev 7765)
@@ -268,13 +268,13 @@
         $part = $path_part[0];
     } elsif (@path_part > 1) {
         Catalyst::Exception->throw(
-          "Multiple PathPart attributes not supported registering ${action}"
+          "Multiple PathPart attributes not supported registering " . $action->reverse()
         );
     }
 
     if ($part =~ m(^/)) {
         Catalyst::Exception->throw(
-          "Absolute parameters to PathPart not allowed registering ${action}"
+          "Absolute parameters to PathPart not allowed registering " . $action->reverse()
         );
     }
 

Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Dispatcher.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Dispatcher.pm	2008-05-19 23:32:41 UTC (rev 7764)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Dispatcher.pm	2008-05-20 08:11:55 UTC (rev 7765)
@@ -14,10 +14,6 @@
 use Tree::Simple::Visitor::FindByPath;
 use Scalar::Util ();
 
-# Stringify to class
-use overload '""' => sub { return ref(shift) }, fallback => 1;
-
-
 #do these belong as package vars or should we build these via a builder method?
 # Preload these action types
 our @PRELOAD = qw/Index Path Regex/;

Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine.pm	2008-05-19 23:32:41 UTC (rev 7764)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine.pm	2008-05-20 08:11:55 UTC (rev 7765)
@@ -19,9 +19,6 @@
 
 no Moose;
 
-# Stringify to class
-use overload '""' => sub { return ref shift }, fallback => 1;
-
 # Amount of data to read from input on each pass
 our $CHUNKSIZE = 64 * 1024;
 

Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst.pm	2008-05-19 23:32:41 UTC (rev 7764)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst.pm	2008-05-20 08:11:55 UTC (rev 7765)
@@ -1234,9 +1234,9 @@
     $c->state(0);
 
     if ( $c->depth >= $RECURSION ) {
-        my $action = "$code";
+        my $action = $code->reverse();
         $action = "/$action" unless $action =~ /->/;
-        my $error = qq/Deep recursion detected calling "$action"/;
+        my $error = qq/Deep recursion detected calling "${action}"/;
         $c->log->error($error);
         $c->error($error);
         $c->state(0);
@@ -1247,7 +1247,7 @@
 
     push( @{ $c->stack }, $code );
     
-    eval { $c->state( &$code( $class, $c, @{ $c->req->args } ) || 0 ) };
+    eval { $c->state( $code->execute( $class, $c, @{ $c->req->args } ) || 0 ) };
 
     $c->_stats_finish_execute( $stats_info ) if $c->use_stats and $stats_info;
     
@@ -1276,9 +1276,10 @@
     return if ( ( $code->name =~ /^_.*/ )
         && ( !$c->config->{show_internal_actions} ) );
 
-    $c->counter->{"$code"}++;
+    my $action_name = $code->reverse();
+    $c->counter->{$action_name}++;
 
-    my $action = "$code";
+    my $action = $action_name;
     $action = "/$action" unless $action =~ /->/;
 
     # determine if the call was the result of a forward
@@ -1297,7 +1298,7 @@
         }
     }
 
-    my $uid = "$code" . $c->counter->{"$code"};
+    my $uid = $action_name . $c->counter->{$action_name};
 
     # is this a root-level call or a forwarded call?
     if ( $callsub =~ /forward$/ ) {

Modified: Catalyst-Runtime/5.80/branches/moose/t/lib/TestApp.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/t/lib/TestApp.pm	2008-05-19 23:32:41 UTC (rev 7764)
+++ Catalyst-Runtime/5.80/branches/moose/t/lib/TestApp.pm	2008-05-20 08:11:55 UTC (rev 7765)
@@ -29,7 +29,7 @@
 sub execute {
     my $c      = shift;
     my $class  = ref( $c->component( $_[0] ) ) || $_[0];
-    my $action = "$_[1]";
+    my $action = $_[1]->reverse;
 
     my $method;
 
@@ -98,4 +98,4 @@
 
 use base qw/Catalyst::Base Class::Data::Inheritable/;
 
-1;
\ No newline at end of file
+1;

Modified: Catalyst-Runtime/5.80/branches/moose/t/lib/TestAppDoubleAutoBug.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/t/lib/TestAppDoubleAutoBug.pm	2008-05-19 23:32:41 UTC (rev 7764)
+++ Catalyst-Runtime/5.80/branches/moose/t/lib/TestAppDoubleAutoBug.pm	2008-05-20 08:11:55 UTC (rev 7765)
@@ -18,7 +18,7 @@
 sub execute {
     my $c      = shift;
     my $class  = ref( $c->component( $_[0] ) ) || $_[0];
-    my $action = "$_[1]";
+    my $action = $_[1]->reverse();
 
     my $method;
 

Modified: Catalyst-Runtime/5.80/branches/moose/t/live_stats.t
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/t/live_stats.t	2008-05-19 23:32:41 UTC (rev 7764)
+++ Catalyst-Runtime/5.80/branches/moose/t/live_stats.t	2008-05-20 08:11:55 UTC (rev 7765)
@@ -23,7 +23,7 @@
 {
     ok( my $response = request('http://localhost/'), 'Request' );
     ok( $response->is_success, 'Response Successful 2xx' );
-    ok( $response->content =~ m/\/default.*?[\d.]+s.*- test.*[\d.]+s/s, 'Stats report');
+    like( $response->content, qr/\/default.*?[\d.]+s.*- test.*[\d.]+s/s, 'Stats report');
 
 }
 




More information about the Catalyst-commits mailing list