[Bast-commits] r8945 - SQL-Abstract/1.x/trunk/lib/SQL

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Mon Mar 8 22:49:00 GMT 2010


Author: ribasushi
Date: 2010-03-08 22:48:59 +0000 (Mon, 08 Mar 2010)
New Revision: 8945

Modified:
   SQL-Abstract/1.x/trunk/lib/SQL/Abstract.pm
Log:
De-golf

Modified: SQL-Abstract/1.x/trunk/lib/SQL/Abstract.pm
===================================================================
--- SQL-Abstract/1.x/trunk/lib/SQL/Abstract.pm	2010-03-08 22:38:05 UTC (rev 8944)
+++ SQL-Abstract/1.x/trunk/lib/SQL/Abstract.pm	2010-03-08 22:48:59 UTC (rev 8945)
@@ -1188,19 +1188,29 @@
 
 sub _METHOD_FOR_refkind {
   my ($self, $meth_prefix, $data) = @_;
-  my $method = List::Util::first {$_} map {$self->can($meth_prefix."_".$_)} 
-                              $self->_try_refkind($data)
-    or puke "cannot dispatch on '$meth_prefix' for ".$self->_refkind($data);
-  return $method;
+
+  my $method;
+  for ($self->_try_refkind($data)) {
+    $method = $self->can($meth_prefix."_".$_)
+      and last;
+  }
+
+  return $method || puke "cannot dispatch on '$meth_prefix' for ".$self->_refkind($data);
 }
 
 
 sub _SWITCH_refkind {
   my ($self, $data, $dispatch_table) = @_;
 
-  my $coderef = List::Util::first {$_} map {$dispatch_table->{$_}} 
-                               $self->_try_refkind($data)
-    or puke "no dispatch entry for ".$self->_refkind($data);
+  my $coderef;
+  for ($self->_try_refkind($data)) {
+    $coderef = $dispatch_table->{$_}
+      and last;
+  }
+
+  puke "no dispatch entry for ".$self->_refkind($data)
+    unless $coderef;
+
   $coderef->();
 }
 




More information about the Bast-commits mailing list