Template::Flute::Specification - Specification class for Template::Flute
$xml_spec = new Template::Flute::Specification::XML; $spec = $xml_spec->parse_file('spec.xml'); $spec->set_iterator('cart', $cart); $conf_spec = new Template::Flute::Specification::Scoped; $spec = $conf_spec->parse_file('spec.conf);
Specification class for Template::Flute.
Creates Template::Flute::Specification object.
Set or get the name of the specification.
Set or get the encoding of the HTML template which is parsed according to this specification.
Add container specified by hash reference CONTAINER.
Add list specified by hash reference LIST.
Add form specified by hash reference FORM.
Add value specified by hash reference VALUE.
Add i18n specified by hash reference I18N.
Add a pattern to the specification. The two keys name and regexp are mandatory.
name
regexp
Returns a plain hash with name => regexp pairs of the patterns set in the specification.
Returns iterator for list named NAME or undef.
Returns inputs for list named NAME or undef.
Return sorts for list named NAME or undef.
Return filters for list named NAME or undef.
Return inputs for form named NAME or undef.
Returns iterator identified by NAME.
Sets iterator for NAME to ITER. ITER can be a iterator object like Template::Flute::Iterator or a reference to an array containing hash references.
Resolves iterator INPUT.
Returns element(s) of the specification tied to HTML class NAME or undef.
Returns element(s) of the specification tied to HTML attribute name or undef.
Returns element(s) of the specification tied to HTML id NAME or undef.
Returns paging for list NAME.
Method to check if the template is consistent with the specification. The method retrieves the list of ids, classes and names, and check if there are template elements attached.
For each specification element without template elements attached, it produces a hash reference with the name, type and a dump of the element.
It returns a list of these hash references, so you can check the template with
my $flute = Template::Flute->new(....); my @bad_elts = $flute->specification->dangling; if (@bad_elts) { warn "empty elements" . Dumper(\@bad_elts); } else { print "all ok\n"; }
Each hashref returned has the following keys set:
Beware that to call this method successfully, the specification must already be processed, so it's safer to call it after $flute->process.
$flute->process
Stefan Hornburg (Racke), <racke at linuxia.de>
<racke at linuxia.de>
Please report any bugs or feature requests at https://github.com/racke/Template-Flute/issues.
Copyright 2010-2021 Stefan Hornburg (Racke) <racke@linuxia.de>.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Template::Flute, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Flute
CPAN shell
perl -MCPAN -e shell install Template::Flute
For more information on module installation, please visit the detailed CPAN module installation guide.