Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 3855
Status: rejected
Priority: 0/
Queue: WWW-Mechanize

People
Owner: MARKSTOS [...] cpan.org
Requestors: frag [...] ripco.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.59
Fixed in: (no value)



Subject: incorrect default value for $index in tick()
In tick(), there's this: my $index = 0; while($input = $self->current_form->find_input($name,"checkbox",$index)) { This contradicts HTML::Form: =item $input = $form->find_input($name, $type, $index) ... The $index is the sequence number of the input matched where 1 is the first. If combined with $name and/or $type then it select the I<n>th input with the given name and/or type. ... sub find_input { my($self, $name, $type, $no) = @_; $no ||= 1; So, using '0' as the default $index/$no value actually results in the first item getting selected twice if it didn't match the first time. This probably isn't a big deal; I noticed it just because I'm hacking with checkboxes. (I need a tick_all().) (Incidentally, this is broken in 0.60, not just 0.59; rt.cpan.org's form doesn't seem to have been notified of 0.60's release yet.)
[guest - Tue Sep 23 18:18:13 2003]: Show quoted text
> > In tick(), there's this: > > my $index = 0; > while($input = $self->current_form-
> >find_input($name,"checkbox",$index)) {
> > This contradicts HTML::Form: > > =item $input = $form->find_input($name, $type, $index) > ... > The $index is the sequence number of the input matched where 1 is > the > first. If combined with $name and/or $type then it select the > I<n>th > input with the given name and/or type. > ... > sub find_input > { > my($self, $name, $type, $no) = @_; > $no ||= 1; > > So, using '0' as the default $index/$no value actually results in > the first item getting selected twice if it didn't match the first > time. > > This probably isn't a big deal; I noticed it just because I'm hacking > with > checkboxes. (I need a tick_all().) > > (Incidentally, this is broken in 0.60, not just 0.59; rt.cpan.org's > form > doesn't seem to have been notified of 0.60's release yet.)
As you can see, we are /way/ behind on some of Mech's bug reports. From what I can tell, we still set "$index = 0" in the code. I'll add this to Mech if you patch the test suite with a test that illustrates the bug, and add patch to fix it as well. You will be given credit in the 'Changes' file. Thanks for the report! Mark
From: MARKSTOS [...] cpan.org
I reviewed this ticket and related code and tests today. It does appear there could be a bug here, but the description is not clear enough for me to create a test from. Considering the report has been open for over 2 years without any other reports of the same issue, it seems like a particular minor issue if it is present. I recommend this report be marked as "resolved" due to old age and lack of a test to reproduce it. Mark On Tue Sep 23 18:18:13 2003, guest wrote: Show quoted text
> > In tick(), there's this: > > my $index = 0; > while($input = $self->current_form-
> >find_input($name,"checkbox",$index)) {
> > This contradicts HTML::Form: > > =item $input = $form->find_input($name, $type, $index) > ... > The $index is the sequence number of the input matched where 1 is > the > first. If combined with $name and/or $type then it select the > I<n>th > input with the given name and/or type. > ... > sub find_input > { > my($self, $name, $type, $no) = @_; > $no ||= 1; > > So, using '0' as the default $index/$no value actually results in > the first item getting selected twice if it didn't match the first > time. > > This probably isn't a big deal; I noticed it just because I'm hacking > with > checkboxes. (I need a tick_all().) > > (Incidentally, this is broken in 0.60, not just 0.59; rt.cpan.org's > form > doesn't seem to have been notified of 0.60's release yet.)