I have done a couple of web sites like this. I did not use WWW::Mechanize, but instead LWP::Simple or LWP::UserAgent, and HTML::TokeParser; HTML::LinkExtractor; no one showed me how to do this, I just did some reading and tried it.
I also have no problem breaking it up into steps. As in, get some data in a format, then use my trusty text editor with Grep expressions to reform the data lines, then back to a perl script to put it somewhere.
In several cases, I looked at the URL that gets me a page of data, then made a list of values to substitute into that URL, then ran a perl script to do it and catch the result. e.g. www.academicsFlow.edu/greatBooks.php?item=1
then looped with values 1 through 99 inserted in that line
If there is a nested link(s) I want to get, I might write a loop that uses the simple mode of LinkExtractor, iterating from one HREF to the next, and saving the results in seqentially named text files.
Then I run through the text files, open each one, and write a simple state machine loop that has a bunch of hard coded knowledge of the format of the page to look for and extract the data fields. Not generalized, not pretty, but works for the task. I write out each of the values in say a tab-delimitted format I have defined.
Lastly, I read in the tab delimited file into whatever target DB, like Outlook I suppose. THough I have not gone there :-)
hth
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.