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.
 
  12 use Test::More tests => 1;
 
  17 my $finder = URI::Find->new(sub {
 
  18   my ($uri_obj, $uri_text) = @_;
 
  22   push @fails, "$uri_text in file $File::Find::name"
 
  23     if !defined get($uri_text);
 
  29   return unless -f $File::Find::name;
 
  30   open(FH, $File::Find::name) or return;
 
  32   { local $/; $text = <FH>; }
 
  34   $finder->find(\$text);
 
  40   ok(0, join "\n", @fails);
 
  42   ok(1, "no broken links found");