MojoX-ValidateHeadLinks

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

.gitignore
bin/validate.head.links.pl
Build.PL
Changelog.ini
Changes
lib/MojoX/ValidateHeadLinks.pm
LICENSE
Makefile.PL
MANIFEST			This list of files
META.json
META.yml
README

bin/validate.head.links.pl  view on Meta::CPAN

{
	pod2usage(2);
}

__END__

=pod

=head1 NAME

validate.head.links.pl - Ensure CSS and JS links in web pages point to real files

=head1 SYNOPSIS

validate.head.links.pl [options]

	Options:
	-help
	-doc_root aDirName
	-maxlevel logOption1
	-minlevel logOption2
	-url aURL

Exit value: 0 for success, 1+ for failure. Die upon error.

lib/MojoX/ValidateHeadLinks.pm  view on Meta::CPAN

# -----------------------------------------------

1;

=head1 NAME

MojoX::ValidateHeadLinks - Ensure CSS and JS links in web pages point to real files

=head1 Synopsis

	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 L</run()> method, which returns the number of errors found. Various logging
options, discussed under L</Constructor and initialization> and in the L</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.

=head1 Description

C<MojoX::ValidateHeadLinks> is a pure Perl module.

It does no more than this:

=over 4

=item o Downloads and parses a web page using L<Mojo::UserAgent>

Hence the -url parameter to validate.head.links.pl.

=item o Checks whether the CSS and JS links point to real files

Hence the -directory parameter to validate.head.links.pl.

=back

It handles the '@import' option used in some CSS links.

=head1 Distributions

This module is available as a Unix-style distro (*.tgz).

See L<http://savage.net.au/Perl-modules.html> for details.

xt/author/run.t  view on Meta::CPAN

use Test::More tests => 1;

# ------------------------

my($url)      = 'http://127.0.0.1/Novels-etc.html';
my(@result)   = `$^X bin/validate.head.links.pl -d /run/shm/html -max debug -u $url`;
my($result)   = join('', @result);
my($expected) = <<EOS;
URL: $url
 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
 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: 0. Errors: 0
Scripts: 2. Errors: 0

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.204 second using v1.00-cache-2.02-grep-82fe00e-cpan-0ab70e22118 )