February 2006
Intermediate to advanced
304 pages
6h 16m
English
One of the most vexing problems facing a webmaster is making sure that all the links on their website are correct. Internal links are difficult to deal with. Every time a file is added, removed, or changed on your website, there is the possibility of generating dead links.
External links are even worse. Not only are they not under your control, but they disappear without a moment's notice.
What's needed is a way of automatically checking a site for links that just don't work. That's where Perl comes in.
1 # 2 # Usage: site-walk.pl <top-url> 3 # 4 use strict; 5 use warnings; 6 7 use HTML::SimpleLinkExtor; 8 use LWP::Simple; 9 use URI::URL; 10 11 my $top_url; # The URL at the top of the tree 12 13 ...