Andy Lester > HTML-Tidy-1.52 > HTML::Tidy

Download:
HTML-Tidy-1.52.tar.gz

Dependencies

Annotate this POD (8)

CPAN RT

New  7
Open  1
View/Report Bugs
Module Version: 1.52   Source   Latest Release: HTML-Tidy-1.56

NAME ^

HTML::Tidy - (X)HTML validation in a Perl object

VERSION ^

Version 1.52

SYNOPSIS ^

    use HTML::Tidy;

    my $tidy = HTML::Tidy->new( {config_file => 'path/to/config'} );
    $tidy->ignore( type => TIDY_WARNING, typed => TIDY_INFO );
    $tidy->parse( "foo.html", $contents_of_foo );

    for my $message ( $tidy->messages ) {
        print $message->as_string;
    }

DESCRIPTION ^

HTML::Tidy is an HTML checker in a handy dandy object. It's meant as a replacement for HTML::Lint. If you're currently an HTML::Lint user looking to migrate, see the section "Converting from HTML::Lint".

EXPORTS ^

Message types TIDY_ERROR, TIDY_WARNING and TIDY_INFO.

Everything else is an object method.

METHODS ^

new()

Create an HTML::Tidy object.

    my $tidy = HTML::Tidy->new();

Optionally you can give a hashref of configuration parms.

    my $tidy = HTML::Tidy->new( {config_file => 'path/to/tidy.cfg'} );

This configuration file will be read and used when you clean or parse an HTML file.

You can also pass options directly to libtidyp.

    my $tidy = HTML::Tidy->new( {
                                    output_xhtml => 1,
                                    tidy_mark => 0,
                                } );

See tidyp -help-config for the list of options supported by libtidyp.

The following options are not supported by HTML::Tidy:

messages()

Returns the messages accumulated.

clear_messages()

Clears the list of messages, in case you want to print and clear, print and clear. If you don't clear the messages, then each time you call parse() you'll be accumulating more in the list.

ignore( parm => value [, parm => value ] )

Specify types of messages to ignore. Note that the ignore flags must be set before calling parse(). You can call ignore() as many times as necessary to set up all your restrictions; the options will stack up.

parse( $filename, $str [, $str...] )

Parses a string, or list of strings, that make up a single HTML file.

The $filename parm is only used as an identifier for your use. The file is not actually read and opened.

Returns true if all went OK, or false if there was some problem calling tidy, or parsing tidy's output.

clean( $str [, $str...] )

Cleans a string, or list of strings, that make up a single HTML file.

Returns the cleaned string as a single string.

libtidyp_version()

Returns the version of the underling tidy library.

INSTALLING LIBTIDYP ^

HTML::Tidy requires that libtidyp be installed on your system. You can obtain libtidyp through your distribution's package manager (make sure you install the development package with headers), or from the libtidyp website at http://github.com/petdance/libtidyp.

CONVERTING FROM HTML::Lint ^

HTML::Tidy is different from HTML::Lint in a number of crucial ways.

BUGS & FEEDBACK ^

Please report any bugs or feature requests at the issue tracker on github http://github.com/petdance/html-tidy/issues. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

Please do NOT use http://rt.cpan.org.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc HTML::Tidy

You can also look for information at:

ACKNOWLEDGEMENTS ^

Thanks to Jonathan Rockway and Robert Bachmann for contributions.

AUTHOR ^

Andy Lester, <andy at petdance.com>

COPYRIGHT & LICENSE ^

Copyright (C) 2005-2010 by Andy Lester

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.1 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: