use WWW::Mechanize to tick one or more checkbox?

use WWW::Mechanize to tick one or more checkbox?

am 17.08.2007 03:17:42 von jck11

Hi all
My html look like


...


How can I use WWW::Mechanize to tick one or more checkbox?

A peice of code of mime:
=========================================================
$mech->form_number(1);
my $name='aaa';
my $value=$mech->value($name);
$value='undef' unless defined $value;
print "[1] value for $name: ($value)\n";
$mech->tick($name, $value);
$value=$mech->value($name);
$value='undef' unless defined $value;
print "[2] value for $name: ($value)\n";
=========================================================

and get the result:
---------------------------------------------------------
[1] value for aaa: (undef)
No checkbox "aaa" for value "undef" in form at test.pl line 56
[2] value for aaa: (undef)
---------------------------------------------------------

change the code to:
=========================================================
$mech->form_number(1);
my $name='aaa';
my $value='111';
$mech->tick($name, $value);
$value=$mech->value($name);
$value='undef' unless defined $value;
print "[2] value for $name: ($value)\n";
=========================================================

and get the result:
---------------------------------------------------------
[2] value for aaa: (undef)
---------------------------------------------------------

It seems don't work this way.
Any suggestion?