3 # adapted from Michael Stevens' test script posted in p5p
4 # in the thread "broken links in blead" from 01/19/2011
6 # caveats: wikipedia seems to have crawler protection and
7 # will give 403 forbidden unless the user agent is faked.
13 if (eval " use LWP::Simple; use URI::Find; 1 ") {
16 plan skip_all => "LWP::Simple or URI::Find not installed";
21 my $finder = URI::Find->new(sub {
22 my ($uri_obj, $uri_text) = @_;
26 push @fails, "$uri_text in file $File::Find::name"
27 if !defined get($uri_text);
33 return unless -f $File::Find::name;
34 open(FH, $File::Find::name) or return;
36 { local $/; $text = <FH>; }
38 $finder->find(\$text);
40 }, "./templates", "./doc",
44 ok(0, join "\n", @fails);
46 ok(1, "no broken links found");