talexb has asked for the wisdom of the Perl Monks concerning the following question:

I am getting the warning

Bad <select> tag 'input' at /usr/share/perl5/WWW/Mechanize.pm line 169 +0
during some tests that I'm running, and I really can't figure out why. WWW::Mechanize calls HTML::Form, which is where this carp is coming from (starting at line 192):
Carp::carp("Bad <select> tag '$tag'") if $^W; if ($tag eq "/form" || $tag eq "input" || ...
All that to say that 'input' appears to be a valid tag, so I'm not sure why I'm getting a warning.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Replies are listed 'Best First'.
Re: WWW::Mechanize and "Bad <select> tag 'input'"
by petdance (Parson) on Mar 19, 2008 at 19:57 UTC
    What does the result of mech-dump look like? Or weblint from HTML::Lint?

    xoxo,
    Andy

      Here's what mech-dump of the page looks like:

      self@wkstn:~/dev$ mech-dump https://somehost/edituser.html POST https://somehost/edituser.pl [fetchuser] referrer=html (hidden readonly) username= (text) <NONAME>=Submit (submit)

      Does that help?

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

        Tells me there's no dropdown called "input" because it doesn't show up in mech-dump. Is it outside the form? Is it dynamically generated by some JavaScript?

        xoxo,
        Andy

        Theres no warning
Re: WWW::Mechanize and "Bad <select> tag 'input'"
by samtregar (Abbot) on Mar 19, 2008 at 18:34 UTC
    Got an <input> inside a <select> perhaps? Or an unterminated <select>? I'd take a hard look at your input HTML - post it if you need help.

    -sam

      It's pretty plain vanilla:

      <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-885 +9-1"> <meta name="Author" content="Some Guy"> <meta name="GENERATOR" content="Some Browser"> <title>Some title</title> </head> <body> <h1>Some heading</h1> <font size="1"><a href="http://somewhere">Somewhere</a></font> <br> <form action="somescript.pl" method="POST" name="somename"> Please enter a username.<br> <input type="hidden" name="referrer" value="html"> <input type="text" size="20" name="username"> <input type="submit" val +ue="Submit"> </form> </body> </html>

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

        Well that's just plain bizarre. I don't know how HTML::Form gets the idea that $tag should be "select" since you don't have a single <select> in your HTML. (The warning you're getting is inside a "if ($tag eq 'select')" block and does appear to be designed to detect invalid tags inside a <select> block.)

        What version of HTML::Form are you using, btw? The latest on CPAN has a similar line, but not exactly the same:

            warn("Bad <select> tag '$tag' in $base_uri\n") if $verbose;

        Is it possible that you're not getting the HTML you think you're getting? Maybe an auth system getting in the way or some other trickery?

        -sam