XHTML::Instrumented - packages to control XHTML
Version 0.092
This package takes valid XHTML as input and outputs valid XHTML that may be changed in several ways.
use XHTML::Instrumented; my $dom = XHTML::Instrumented->new( path => '/var/www/html', type => 'nl', default_type => 'en', name => 'index', cachepath => '/tmp/the_cache_path/', # run time replace_name => 'home', # compile time filter => sub { my $tag = shift; my $args = shift; if (my $path = $args->{href}) { } }, };
This will load the file /var/www/html/nl/index.html or if that is not found /var/www/html/en/index.html or an exception will be thrown.
/var/www/html/nl/index.html
/var/www/html/en/index.html
You can also directly input html, although this is mainly used for testing.
use XHTML::Instrumented; my $dom = XHTML::Instrumented->new( name => \"<html><head></head><body>hi</body></html>", );
You can also directly give a complete filename.
use XHTML::Instrumented; my $dom = XHTML::Instrumented->new( filename => '/var/www/html/en/index.html', );
The new() constructor method instantiates a new XHTML::Intrumented object. The template is either compiled or loaded as well.
XHTML::Intrumented
The parameters to the constructor are describe in more detail in the descriptions of the methods with the same name path() name() type() default_type() extension() filename() cachepath() replace_name()
There is also a filter parameter: it is a call-back that allows the arguments to tags to be modified at compile time.
filter
tags
Get a XHTML::Instrumented object.
This the complete name (path and filename) of the file that was compiled to create the object. If the input was not from a file this will be undefined. This is either build up from the path, type or default_type, name and extension values or is set directly by the constructor.
This is the base path to the input file. It is set by an argument to the constructor.
This is the base name of the input file. It is set by an argument to the constructor.
This is the default type of the input file. This is really just an extra element to the path. It is set by an argument to the constructor.
If the file is not found using the type then this is tried.
type
This is the extension to the file. It defaults to ".html' and can be set by the constructor.
This is the base directory where the cache file will be stored. It is set by an argument to the constructor.
This is the full name of the cache file.
This is the default name of the file that will be used by the :replace operator.
This returns the modified xhtml.
This returns the html between the Head tags!
This returns a form object.
Get a loop control object.
loop
headers => [array of headers] data => [arrays of data] default => default value for any undefined data inclusive => include the tag that started the loop
inclusive is normally controlled in the template.
This return a general control object. I can control 4 actions:
args is a helper function. It is the same as:
args
replace(args => { @_ });
Return a list of XHTML::Intramented::Entry objects that have type 'tag';
Both of these functions are used internally by the XHTML::Instrumented and are only listed here for completeness.
This causes the input to be parsed.
if input is a string it is assumed to be a filename. If input is a SCALAR is is treated as HTML;
This function take the template and the control structure and returns a block of XHTML.
"G. Allen Morris III" <gam3@gam3.net>
Copyright (C) 2007-2008 G. Allen Morris III, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install XHTML::Instrumented, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XHTML::Instrumented
CPAN shell
perl -MCPAN -e shell install XHTML::Instrumented
For more information on module installation, please visit the detailed CPAN module installation guide.