Skip to Main Content
Wicked Cool Perl Scripts
book

Wicked Cool Perl Scripts

by Steve Oualline
February 2006
Intermediate to advanced content levelIntermediate to advanced
304 pages
6h 16m
English
No Starch Press
Content preview from Wicked Cool Perl Scripts

#6 Website Link Checker

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.

The Code

 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Perl Debugged

Perl Debugged

Peter Scott, Ed Wright
Perl & LWP

Perl & LWP

Sean M. Burke
Pro Perl

Pro Perl

Peter Wainwright

Publisher Resources

ISBN: 1593270623Catalog PageErrata