hello monks :)
it's waaay too long i haven't been coding (at all), and especially coding in perl, so please forgive me for this dumb dumb dumb question.
I haven't found it answered, so either I can't even properly search or it's so dumb nobody ever dared to ask.
my need : I've got two arrays, say
Well i am currently working on a small solution: I have tried various tutorials
(examples of Mecha - that i have found on the net) not oll of them work - some of them are broken!
Now i try to get some real-world-task! This is much more interesting for me as a Perl-beginner
i start with a Mechanize-job, which sure can be done with LWP too. But at the beginning i want to keep it pretty
simple.
Well i need Mecha - particularly for doing the form based search and selecting the individual entries.
goal: i have approximatley 100 pages to parse
they are organized like that:
http://www.address/307.html
http://www.address/308.html
http://www.address/309.html
Hmm - i guess that the algorithm would be basically only one nested loop:
hmm - one outer loop runs the form based search,
and yes: one inner loop processes the search results.
well i did it like this one here:
use WWW::Mechanize;
my $mech = WWW::Mechanize->new();
my $url = "here the urls go in ";
$mech->cookie_jar->set_cookie(0,"start",1,"/",".test.com");
$mech->get($url);
It's really really !!! just one loop, isn't it?
foreach my $url (@urls) {
my $response = $ua->post($url, \%data);
my $result = parse_response($response);
}
well the thing is pretty simple - i need to do two things with Mechanize
- particularly for doing the form based search and
- selecting the individual entries and parse them
well what do you say?!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.