The dirtiest way to do this is:
#!/usr/bin/perl -w
use strict;
for (1..273) {
`wget http://www.my-site.com/mydir/?Page=$_`;
}
Note: this code is untested, and is missing any sort of error checking and assumes you're using a UNIX like system with the wget command installed. Not much of a solution.
Do not trust this code, but you get the idea.
A better way would be to have a look at the modules and utilities in
Bundle::LWP and base a more robust script on those.
Implementation is left as a task for the reader.
Update: Beaten to it by moodster! :-)
Great minds think alike. ;)
Further update: I feel quite honored to have merlyn's attention :-)
I posted the incorrect/dirty/horrific snippet as a basis of one solution, LWP::Simple is clearly a better solution - and I made a point of mentioning Bundle::LWP, which includes the mirror functionality that merlyn has demostrated.
So, ignoring the obvious benefits of LWP::Simple,
I have seen the error of my ways with the use of backticks here - system() should have been used instead of backticks to fork wget.
That method still isn't fanstatic - I stand by my disclaimer :-)
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.