On Jan 31, Adam Foxson said:
>ok 1
>not ok 2
>ok 3
>not ok 4
>not ok 5
Test 1 is the inclusion of the module.
Tests 2 through 5 are shown below:
my @URLs = qw(
http://www.pobox.com/~japhy/does_not_exist.404
http://www.pobox.com/~japhy/index.html
http://search.cpan.org/images/republic.gif
);
print "not " if $URLs[1] ne FirstGoodURL->in(@URLs);
print "ok 2\n";
print "not " if $URLs[2] ne FirstGoodURL->with('image/gif')->in(@URLs);
print "ok 3\n";
print "not " if $URLs[1] ne FirstGoodURL->with(qr/html/)->in(@URLs);
print "ok 4\n";
print "not " if $URLs[0] ne FirstGoodURL->with(404)->in(@URLs);
print "ok 5\n";
Perhaps the LWP::UserAgent module is slightly ill? I don't see why ONE of
the four tests would succeed. This is the code that makes the HEAD
request:
my $req = $ua->request(HTTP::Request->new(HEAD => $_));
my ($rc,$rt) = ($req->code, $req->content_type);
There's no reason I can think of for ONE test to pass and the others to
fail. Suggestions/insights, anyone?
The module can be found at my web site (in addition to CPAN):
http://www.pobox.com/~japhy/modules/FirstGoodURL/FirstGoodURL-1.11/
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
PerlMonks - An Online Perl Community http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/