GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
CGI::Application::Plugin::HtmlTidy(3) User Contributed Perl Documentation CGI::Application::Plugin::HtmlTidy(3)

CGI::Application::Plugin::HtmlTidy - Add HTML::Tidy support to CGI::Application

version 1.05

  use CGI::Application::Plugin::HtmlTidy;
  
  sub cgiapp_postrun {
    my ($self, $contentref) = @_;

        # your post-process code here
        
    $self->htmltidy_clean($contentref);
  }

  
  # generate a validation report
  use CGI::Application::Plugin::DevPopup;
  use CGI::Application::Plugin::HtmlTidy;

This release integrates with CGI::Application::Plugin::DevPopup. If that plugin is active, this one will add an HTML validation report. As a consequence, htmltidy_validate() is no longer exported, and should not be called directly.

This plugin is a wrapper around HTML::Tidy. It exports two methods that allow you to either validate or clean up the output of your cgiapp application. They should be called at the end of your postrun method.

The htmltidy_validate method is a helpful addition during development. It generates a detailed report specifying the issues with your html.

The htmltidy_clean modifies your output to conform to the W3C standards. It has been in use for quite some time on a largish site (generating over 10 million pages per day) and has proven to be quite stable and fast. Every single page view is valid html, which makes many browsers happy :-)

libtidy is extremely configurable. It has many options to influence how it transforms your documents. HTML::Tidy communicates these options to libtidy through a configuration file. In the future, it may also allow programmatic access to all options.

You can specify the configuration using cgiapp's param() method, or in your instance script through the PARAM attribute, or through the htmltidy_config() method. This plugin looks for a parameter named htmltidy_config, whose value should be a hash ref. This hash ref is then passed on directly to HTML::Tidy. Currently the only supported parameter is "config_file".

Here's an example:

  sub setup {
    my $self = shift;
        $self->param( htmltidy_config => {
                            config_file => '/path/to/my/tidy.conf',
                        });
  }

This plugin comes with a default configuration file with the following settings:

        tidy-mark:      no
        wrap:           120
        indent:         auto
        output-xhtml:   yes
        char-encoding:  utf8
        doctype:        loose
        add-xml-decl:   yes
        alt-text:       [image]

htmltidy
Direct access to the underlying HTML::Tidy object.
htmltidy_config
Pass in a hash of options to configure the behaviour of this plugin. Accepted keys are:
config_file
The path to a config file used by tidy. See the tidy man page for details.
tidy config options
HTML::Tidy 1.08 now supports tidy options directly, so there is no need for a separate config file anymore.
htmltidy_validate
If you're using CGI::Application::Plugin::DevPopup, this method is used to generate a report for it.It parses your output, and generates a detailed report if it doesn't conform to standards.
htmltidy_clean
Parses and cleans your output to conform to standards.

CGI::Application, HTML::Tidy.

The cgiapp mailing list can be used for questions, comments and reports. The CPAN RT system can also be used.

Rhesa Rozendaal, <rhesa@cpan.org>

Copyright (C) 2005-2007 by Rhesa Rozendaal

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.2 or, at your option, any later version of Perl 5 you may have available.

2011-05-15 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.