Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

WWW::Mechanize help

by Anonymous Monk
on May 06, 2012 at 08:54 UTC ( #969127=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

hiya monks :p i'm tryna get all text boxes from a web page and filter out the one that i want..
$mech->get( $page ); my @find_text = $mech->find_all_inputs( type => 'text' ); for $boxes (@find_text) { if (length($boxes) > 100) { print #contents of the input box here? } }
if the length of the string in the input box is > 100 then thats the box i want. the catch here is that the input box has no name or ID, just a tag.

Replies are listed 'Best First'.
Re: WWW::Mechanize help
by zwon (Abbot) on May 06, 2012 at 10:48 UTC

    so what's the problem, you already got a list of inputs, why do you need names? Just use the value method:

    for $boxes (@find_text) { if (length($boxes->value) > 100) { print $boxes->value; } }
    (not tested)
      it does nothing...

        it does nothing...

        Sure it does

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://969127]
Approved by tobyink
help
Chatterbox?
[james28909]: i think im good
[james28909]: i just watched a youtube video
[karlgoethebier]: james28909: Did you look on CPAN?
[james28909]: lol
[karlgoethebier]: james28909: Super Search here ?
[karlgoethebier]: james28909: No kidding

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2017-05-25 16:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?