MojoX::ValidateHeadLinks - Ensure CSS and JS links in web pages point to real files
shell> validate.head.links.pl -h shell> validate.head.links.pl -d /run/shm/html -u http://127.0.0.1/index.html
This program calls the "run()" method, which returns the number of errors found. Various logging options, discussed under "Constructor and initialization" and in the "FAQ", control the amount of output. Nothing is printed by default.
On my machine, /run/shm/ is the directory used to access the Debian built-in RAM disk, and /run/shm/html/ is my web server document root directory.
Since this script -validate.head.links.pl - ships in the bin/ directory, it is installed somewhere along your executable search path when the module is installed.
MojoX::ValidateHeadLinks is a pure Perl module.
MojoX::ValidateHeadLinks
It does no more than this:
Hence the -url parameter to validate.head.links.pl.
Hence the -directory parameter to validate.head.links.pl.
It handles the '@import' option used in some CSS links.
This module is available as a Unix-style distro (*.tgz).
See http://savage.net.au/Perl-modules.html for details.
See http://savage.net.au/Perl-modules/html/installing-a-module.html for help on unpacking and installing.
new(...) returns an object of type MojoX::ValidateHeadLinks.
This is the class contructor.
Usage: MojoX::ValidateHeadLinks -> new().
MojoX::ValidateHeadLinks -> new()
This method takes a hashref of options.
Call new() as new({option_1 => value_1, option_2 => value_2, ...}).
new()
new({option_1 => value_1, option_2 => value_2, ...})
Available options (which are also methods):
Use this to specify the doc root directory of your web server. This option is mandatory.
Default: ''.
This option affects Log::Handler.
See the Log::Handler::Levels docs, and the "FAQ".
Default: 'notice'. This means nothing is printed.
For maximum details in the printed report, try:
MojoX::ValidateHeadLinks -> new(doc_root => $d, maxlevel => 'debug', url => $u) -> run;
See the Log::Handler::Levels docs.
Default: 'error'.
No lower levels are used.
Use this to specify the URL of the web page to be checked.
If the string supplied does not start with 'http', then 'http://' is prefixed to $url automatically.
Here, the [] indicate an optional parameter.
Get or set the name of your web server doc root directory.
Log the string $message at log level $level.
The logger object is of class Log::Handler.
Get or set the value used by the logger object.
For more details in the printed report, try:
'maxlevel' is a parameter to "new()". See "Constructor and Initialization", and the "FAQ", for details.
'minlevel' is a parameter to "new()". See "Constructor and Initialization" for details.
See "Constructor and Initialization" for details on the parameters accepted by "new()".
Logs $message at log level error, and then dies.
Errors can arise in these situations:
Does all the work.
Returns the number of errors detected, so 0 is good and N > 0 is bad.
Get or set the URL of the web page your wish to check.
linkcheck.pl does not check that links to non-HTML resources (CSS, JS) point to real files.
In these examples, $DR stands for the /run/shm/html/ directory, the doc root of my web server.
Output from a real run, where my dev web site is the same as my real web site (so -d $DR works):
shell> validate.head.links.pl -d $DR -url http://savage.net.au/Novels-etc.html -max debug URL: http://savage.net.au/Novels-etc.html Import: /run/shm/html/assets/js/DataTables-1.9.4/media/css/demo_page.css Import: /run/shm/html/assets/js/DataTables-1.9.4/media/css/demo_table.css Link: /run/shm/html/assets/css/local/default.css Script: /run/shm/html/assets/js/DataTables-1.9.4/media/js/jquery.js Script: /run/shm/html/assets/js/DataTables-1.9.4/media/js/jquery.dataTables.min.js Imports: 2. Errors: 0 Links: 1. Errors: 0 Scripts: 2. Errors: 0 shell> validate.head.links.pl -d $DR -url http://savage.net.au/Novels-etc.html -max info Imports: 2. Errors: 0 Links: 1. Errors: 0 Scripts: 2. Errors: 0 shell> validate.head.links.pl -d $DR -url http://savage.net.au/Novels-etc.html -max error (No output) shell> echo $? 0
https://github.com/ronsavage/MojoX-ValidateHeadLinks
Email the author, or log a bug on RT:
https://rt.cpan.org/Public/Dist/Display.html?Name=MojoX::ValidateHeadLinks.
MojoX::ValidateHeadLinks was written by Ron Savage <ron@savage.net.au> in 2012.
Home page: http://savage.net.au/index.html.
Australian copyright (c) 2012, Ron Savage.
All Programs of mine are 'OSI Certified Open Source Software'; you can redistribute them and/or modify them under the terms of The Artistic License, a copy of which is available at: http://www.opensource.org/licenses/index.html
To install MojoX::ValidateHeadLinks, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MojoX::ValidateHeadLinks
CPAN shell
perl -MCPAN -e shell install MojoX::ValidateHeadLinks
For more information on module installation, please visit the detailed CPAN module installation guide.