Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
My PC is running on windows but my web host is unix, I'm hoping theirs a method I can kill both birds with a single stone.
Taking this very cutdown script, can someone show me a very simple fix to add fork() to this? Everything inside the loop is what I'd aim for, to make the page crawling a multi-process.
I do know this isn't good for the server, but in the end I'm not going to use this script for anything except learning how to fork.
#!/usr/bin/perl use warnings; use strict; my $site = "http://ftw.generation.no/?n="; my $cnt = 0; use LWP::Simple; for (1 .. 4000) { $cnt++; my $page = get("$site$cnt"); $page =~ m#src="img/(.+)"\s+alt#; getstore("http://ftw.generation.no/img/$1", $1); print "$1 saved-- $cnt/2584\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to use FORK
by blazar (Canon) on Jun 01, 2007 at 16:03 UTC | |
|
Re: How to use FORK
by ikegami (Patriarch) on Jun 01, 2007 at 15:57 UTC | |
|
Re: How to use fork
by betterworld (Curate) on Jun 02, 2007 at 15:11 UTC |