1: package FirstGoodURL;
2:
3: use LWP::UserAgent;
4: use strict;
5: use vars qw( $VERSION );
6:
7: $VERSION = '1.00';
8:
9: my $ua = new LWP::UserAgent;
10:
11: sub find {
12: my ($class,@URLs) = @_;
13: my $req;
14: for (@URLs) {
15: return $_ if $ua->request
16: (new HTTP::Request HEAD => $_)->code == 200;
17: }
18: }
19:
20: 1;
21:
22: # go to http://www.pobox.com/~japhy/modules/
23: # for the module and its docs
|
|---|