beowulf has asked for the wisdom of the Perl Monks concerning the following question:
Life? What's a life?use LWP::Simple; use CGI qw(:standard escapeHTML); { my %cache = (Time => 0, Data => ""); my $comicsdata = { Dilbert => { Page => "http://dilbert.com" , Regex => qr[(/comics/dilbert/archive/images/dilbert\d+.gif)] , Base => "http://dilbert.com" } }; sub get_data { my $out_comics = ""; my $name = ""; foreach $name (keys %$comicsdata) { my $page = get("$$comicsdata{$name}{Page}"); my $regex = $$comicsdata{$name}{Regex}; my @comics = ($page =~ m/$regex/g); my $base = $$comicsdata{$name}{Base}; @comics = map { $base . $_ } @comics; $out_comics .= $name . a({-href=>$page}, map { img({-src=> $_}) +} @comics); } $cache{Time} = time; return($cache{Data} = $out_comics); } } print get_data;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help!!!!!!!!
by dws (Chancellor) on Feb 22, 2001 at 04:19 UTC | |
by beowulf (Scribe) on Feb 22, 2001 at 23:51 UTC | |
|
Re: Help!!!!!!!!
by yakko (Friar) on Feb 22, 2001 at 04:05 UTC | |
|
Re: Help!!!!!!!!
by aardvark (Pilgrim) on Feb 22, 2001 at 04:25 UTC | |
|
Re: Help!!!!!!!!
by beowulf (Scribe) on Feb 22, 2001 at 23:30 UTC | |
|
Re: Broken Dilbert archive script using LWP::Simple
by mazingerz (Initiate) on Jul 06, 2001 at 00:06 UTC |