#!/usr/bin/perl
# Stefan Chakerian (schake@sandia.gov)
# Jun 2006

# requires a lot of modules from CPAN
# WWW::CheckSite, WWW::Mechanize, Time-HiRes,
# HTML-Template, Template-Toolkit, and possibly others

# will break if interrupted... just make sure the buffer is
# flushed and there's a </web> at the end.

# could be expanded to take base url from commandline,
# and possibly figure a way to find the referrer url
# which would show the broken links.

exit 0;

use WWW::CheckSite::Spider;
print "<web>\n";

print "  <Acro>\n";
my $sp = WWW::CheckSite::Spider->new(
     uri      => 'http://software.sandia.gov/Acro/',);
while ( my $page = $sp->get_page ) {
  print "  <failed status=\"$page->{status}\" url=\"$page->{org_uri}\" />\n"
        if (!$page->{success});
  }
print "  </Acro>\n";

print "  <SQE>\n";
my $sqe_sp = WWW::CheckSite::Spider->new(
     uri      => 'http://software.sandia.gov/~sqe/',);
while ( my $page = $sqe_sp->get_page ) {
  print "  <failed status=\"$page->{status}\" url=\"$page->{org_uri}\" />\n"
        if (!$page->{success});
  }
print "  </SQE>\n";

print "</web>\n";
