Skip Menu |

This queue is for tickets about the HTML-Form CPAN distribution.

Report information
The Basics
Id: 75289
Status: rejected
Priority: 0/
Queue: HTML-Form

People
Owner: Nobody in particular
Requestors: d.thomas [...] its.uq.edu.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 6.02
Fixed in: (no value)



Subject: t/form.t Test 15 fix interacts with a LOCAL patch
perl 5.14.2, RHEL6.2, with up to date versions of all relevant modules I'm using WWW::Mechanize to simulate a form=based login for our monitoring system Running from Firefox, Live HTTP headers shows the x-www-form-urlencoded string ends with: ...&BP101.DUMMY_B.MENSYS.1=Log+in+%3E%3E which comes from <input type="submit" name="BP101.DUMMY_B.MENSYS.1" value="Log in &gt;&gt;" class="formsubfree" /> This key/value is omitted from WWW::Mechanize output but be made to appear by commenting-out one line in HTML::Form sub form_name_value { my $self = shift; # return unless $self->{clicked}; return $self->SUPER::form_name_value(@_); } Unfortunately that patch now results in a test failure with 6.02. Is this patch absolutely wrong or does it just interact badly the the fix for test 15 ? [I suppose my fix could have really been a workaround for Mech]
Subject: html-form-6.02-test.txt
t/form-label.t ......... ok t/form-maxlength.t ..... ok t/form-multi-select.t .. ok t/form-param.t ......... ok t/form-selector.t ...... ok t/form-unicode.t ....... ok t/form.t ............... 1/127 # Test 15 got: "POST http://localhost/\nContent-Length: 83\nContent-Type: application/x-www-form-urlencoded\n\ni.x=1&i.y=1&c=on&r=b&t=&p=&h=xyzzy&s=Doit!&f=&x=&a=%0D%0Aabc%0D%0A+++&s=bar&m=a&m=b\n" (t/form.t at line 82) # Expected: "POST http://localhost/\nContent-Length: 75\nContent-Type: application/x-www-form-urlencoded\n\ni.x=1&i.y=1&c=on&r=b&t=&p=&h=xyzzy&f=&x=&a=%0D%0Aabc%0D%0A+++&s=bar&m=a&m=b\n" # Line 2 is changed: # - "Content-Length: 75\n" # + "Content-Length: 83\n" # Line 5 is changed: # - "i.x=1&i.y=1&c=on&r=b&t=&p=&h=xyzzy&f=&x=&a=%0D%0Aabc%0D%0A+++&s=bar&m=a&m=b\n" # + "i.x=1&i.y=1&c=on&r=b&t=&p=&h=xyzzy&s=Doit!&f=&x=&a=%0D%0Aabc%0D%0A+++&s=bar&m=a&m=b\n" # t/form.t line 82 is: ok($f->click->as_string, <<'EOT'); t/form.t ............... Failed 1/127 subtests Test Summary Report ------------------- t/form.t (Wstat: 0 Tests: 127 Failed: 1) Failed test: 15 Files=7, Tests=192, 0 wallclock secs ( 0.07 usr 0.01 sys + 0.47 cusr 0.04 csys = 0.59 CPU) Result: FAIL Failed 1/7 test programs. 1/192 subtests failed. make: *** [test_dynamic] Error 255
The patch is wrong, because HTML::Form is supposed to only report one of the clickable inputs.  It will select the first one it finds in the form unless you provide a name as argument to $form->click().  With your patch it will always report all clickable inputs.

My guess is that your form has some other <input type="submit"> or <input type="image"> that HTML::Form picks instead.

You can try to use $mech->click("BP101.DUMMY_B.MENSYS.1") for the case reported.