in reply to HTML::Form getting button by id

The documentation for ->find_input in HTML::Form says:

This method is used to locate specific inputs within the form. All inputs that match the arguments given are returned. In scalar context only the first is returned, or undef if none match.

If $selector is specified, then the input's name, id, class attribute must match. A selector prefixed with '#' must match the id attribute of the input. A selector prefixed with '.' matches the class attribute. A selector prefixed with '^' or with no prefix matches the name attribute.

How would you phrase it so that it is more clear how to search an input by its id attribute?

Replies are listed 'Best First'.
Re^2: HTML::Form getting button by id
by mhearse (Chaplain) on Jul 09, 2012 at 19:30 UTC
    Well, I did scan the HTML::Form perldoc before making this post. I would say that the doc could be more digestible by using the term pattern instead of selector. Not that I'm making any excuses. And (don't worry, I'm already wearing my dunce cap) my code is still broke:
    my $login; foreach (HTML::Form->parse($self->{resp})) { if ($_->find_input('#btnLogin')) { $login = $_; last; } } die $! if not $login;

      What part of your code does not work, and how does it fail? Also, what is the input HTML?

        Please disregard my post. I realized that my server at work is running a rather old version of perl: v5.8.8 And thus an old version of HTML::Form which doesn't appear to support the methodology mentioned above. I confirmed that my code works using a recent HTML::Form. My apologies.