WWW :: Mechanize Field Methods
1 answer
$mech -> field($name, $value)
Field () allows you to set one name at a time. But
$mech -> set_fields($name => $value, $name2 => $value2,... $nameN => $valueN)
... set_fields () allows you to set multiple names at the same time.
It doesn't really matter, because you can always use the first one in a loop:
my @data = (
first => 'A',
last => 'B',
age => 22,
#possibly 100,000 other name/value pairs
);
my($name, $value);
while(@data) {
($name, $value) = splice(@data, 0, 2);
$mech->field($name, $value);
}
... but it's more convenient to write:
$mech->set_fields(@data);
+4
source to share