Test::HTML::W3C(3pm)

πŸ“¦
version 0.04 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

✨ NAME ✨

Test::HTML::W3C β€” it does W3C HTML validation testing, bestie πŸ’–


🌸 SYNOPSIS 🌸

use Test::HTML::W3C tests => $test_count;
# or
use Test::HTML::W3C 'show_detail';
# or when using both
use Test::HTML::W3C tests => $test_count, 'show_detail';

is_valid_markup($my_html_scalar);

is_valid_file("/path/to/my/file.html");

is_valid("http://example.com");

# Get the underlying WebService:;Validator::W3C::HTML object
my $validator = validator();

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the whole point of this module? It's a little wrapper around the W3C that plays nice with the Test::More testing framework. That's it, that's the vibe. She's a bridge, she's a connector, she's the group chat between your tests and the W3C. πŸ’…


πŸŽ€ ABUSE πŸŽ€

okay real talk for a sec, bestie, because this one actually matters. πŸ™ˆ

The W3C validation pages and services are a shared resource. Like, everybody's using them. So if you're planning to run many many tests, pls pls pls consider using your own installation of the validation programs instead, and then point at your local install by modifying the local validtor:

my $v = validator();
$v->validator_uri($my_own_validator);

See the documentation for WebService:;Validator::W3C::HTML and the W3C's site at http://validator.w3.org/ for details.


🌈 validator();

Description: Returns the underlying WebService::Validator::HTML::W3C object. She's the main character underneath it all. πŸ‘‘

Parameters: None.

Returns: $validator


🌈 plan();

Description: Access to the underlying "plan" method provided by Test::Builder.

Parameters: As per Test::Builder


🌈 is_valid_markup($markup[, $name]);

Description: is_valid_markup tests whether the text in the provided scalar value correctly validates according to the W3C specifications. This is useful if you have markup stored in a scalar that you wish to test that you might get from using LWP or WWW::Mechanize for example...

Parameters: $markup, a scalar containing the data to test, $name, an optional descriptive test name.

Returns: None.


🌈 is_valid_file($path[, $name]);

Description: is_valid_file works the same way as is_valid_markup, except that you can specify the text to validate with the path to a filename. This is useful if you have pregenerated all your HTML files locally, and now wish to test them. πŸ“

Parameters: $path, a scalar, $name, an optional descriptive test name.

Returns: None.


🌈 is_valid($url[, $name]);

Description: is_valid, again, works very similarly to the is_valid_file and is_valid_file, except you specify a document that is already online with its URL. This can be useful if you wish to periodically test a website or webpage that dynamically changes over time for example, like a blog or a wiki, without first saving the html to a file using your browswer, or a utility such as wget. ✨

Parameters: $url, a scalar, $name, an optional descriptive test name.

Returns: None.


🌈 diag_html($url);

Description: If you want to display the actual errors reported by the service for a particular test, you can use the diag_html function. Please note that you must have imported 'show_detail' for this to work properly. πŸ‘€

use Test::HTML::W3C 'show_detail';

is_valid_markup("<html></html">, "My simple test") or diag_html();

Parameters: $url, a scalar.

Returns: None.


πŸ’œ SEE ALSO πŸ’œ

  • Test::Builder::Module for creating your own testing modules.
  • Test::More for another popular testing framework, also based on Test::Builder
  • Test::Harness for detils about how test results are interpreted.

πŸ‘‘ AUTHORS πŸ‘‘

Victor <victor73@gmail.com> with inspiration from the authors of the Test::More and WebService::Validator::W3C:HTML modules. Shoutout to the inspo, fr fr. 🫢


πŸ’€ BUGS πŸ’€

See http://rt.cpan.org to report and view bugs. Go be a hero, bestie.


Copyright 2006 by Victor <victor73@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html


and that's the whole page, bestie!! πŸ’–βœ¨ this one's from perl v5.32.0, dated 2021-01-07, filed under Test::HTML::W3C(3pm) β€” slay, mwah πŸŽ€πŸ’…

πŸ“¦ where this page comes from