[Jifty-commit] r6941 - jifty/trunk/lib/Jifty/Test/WWW

Jifty commits jifty-commit at lists.jifty.org
Tue May 5 14:20:49 EDT 2009


Author: sartak
Date: Tue May  5 14:20:48 2009
New Revision: 6941

Modified:
   jifty/trunk/lib/Jifty/Test/WWW/Mechanize.pm

Log:
Improve clarity and correctness of moniker_for

Modified: jifty/trunk/lib/Jifty/Test/WWW/Mechanize.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Test/WWW/Mechanize.pm	(original)
+++ jifty/trunk/lib/Jifty/Test/WWW/Mechanize.pm	Tue May  5 14:20:48 2009
@@ -94,12 +94,13 @@
     # possibly a form with only its continuation-marking hidden field.
     # Fall back to a submit field with similar attributes.
     for my $input ($f->inputs) {
-	if ($input->type eq "submit" and $input->name =~ /$action/
-	    and $input->name =~ /J:ACTIONS=([^|]+)\|/ ) {
-	  $input->name =~ /J:ACTIONS=([^|]+)\|/;
-	  my $moniker = $1;
-	  return $moniker;
-      }
+        my $name = $input->name || '';
+
+        next unless $input->type eq "submit";
+        next unless $name =~ /\Q$action\E/;
+        my ($moniker) = $name =~ /J:ACTIONS=([^|]+)\|/
+            or next;
+        return $moniker;
     }
   }
   return undef;


More information about the Jifty-commit mailing list