.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "HTML::Template::Pluggable 3pm" .TH HTML::Template::Pluggable 3pm 2024-03-30 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME HTML::Template::Pluggable \- Extends HTML::Template with plugin support .SH SYNOPSIS .IX Header "SYNOPSIS" Just use this module instead of HTML::Template, then use any plugins, and go on with life. .PP .Vb 2 \& use HTML::Template::Pluggable; \& use HTML::Template::Plugin::Dot; \& \& # Everything works the same, except for functionality that plugins add. \& my $t = HTML::Template::Pluggable\->new(); .Ve .SH "THE GOAL" .IX Header "THE GOAL" Ideally we'd like to see this functionality merged into HTML::Template, and turn this into a null sub-class. .SH STATUS .IX Header "STATUS" The design of the plugin system is still in progress. Right now we have just two triggers, in param and output. The name and function of this may change, and we would like to add triggers in \fBnew()\fR and other methods when the need arises. .PP All we promise for now is to keep HTML::Template::Plugin::Dot compatible. Please get in touch if you have suggestions with feedback on designing the plugin system if you would like to contribute. .SH "WRITING PLUGINS" .IX Header "WRITING PLUGINS" HTML::Template offers a plugin system which allows developers to extend the functionality in significant ways without creating a creating a sub-class, which might be impossible to use in combination with another sub-class extension. .PP Currently, two triggers have been made available to alter how the values of TMPL_VARs are set. If more hooks are needed to implement your own plugin idea, it may be feasible to add them\-\- check the FAQ then ask about it on the list. .PP Class::Trigger is used to provide plugins. Basically, you can just: .PP .Vb 1 \& HTML::Template\->add_trigger(\*(Aqmiddle_param\*(Aq, \e&trigger); .Ve .PP A good place to add one is in your plugin's \f(CW\*(C`import\*(C'\fR subroutine: .PP .Vb 6 \& package HTML::Template::Plugin::MyPlugin; \& use base \*(AqExporter\*(Aq; \& sub import { \& HTML::Template\->add_trigger(\*(Aqmiddle_param\*(Aq, \e&dot_notation); \& goto &Exporter::import; \& } .Ve .SS "TRIGGER LOCATIONS" .IX Subsection "TRIGGER LOCATIONS" .IP param 4 .IX Item "param" We have added one trigger location to this method, named \f(CW\*(C`middle_param\*(C'\fR. .Sp .Vb 2 \& # in a Plugin\*(Aqs import() routine. \& HTML::Template\->add_trigger(\*(Aqmiddle_param\*(Aq, \e&_set_tmpl_var_with_dot ); .Ve .Sp This sets a callback which is executed in \fBparam()\fR with all of the same arguments. It is only useful for altering how /setting/ params works. The logic to read a param is unaffected. .Sp It can set any TMPL_VAR values before the normal param logic kicks in. To do this, \f(CW\*(C`$self\->{param_map}\*(C'\fR is modified as can be seen from source in \&\fBHTML::Template::param()\fR. However, it must obey the following convention of setting \f(CW$self\fR\->{param_map_done}{$param_name} for each param that is set. \&\f(CW$param_name\fR would be a key from \f(CW\*(C`$self\->{param_map}\*(C'\fR. This notifies the other plugins and the core \fBparam()\fR routine to skip trying to set this value. \&\f(CW$self\fR\->{param_map_done} is reset with each call to \fBparam()\fR, so that like with a hash, you have the option to reset a param later with the same name. .IP output 4 .IX Item "output" One trigger location here: \f(CW\*(C`before_output\*(C'\fR. .Sp .Vb 1 \& HTML::Template\->add_trigger(\*(Aqbefore_output\*(Aq, \e&_last_chance_params ); .Ve .Sp This sets a callback which is executed right before output is generated. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP o 4 .IX Item "o" HTML::Template::Plugin::Dot \- Add Template Toolkit's magic dot notation to HTML::Template. .SH AUTHOR .IX Header "AUTHOR" Mark Stosberg, \f(CW\*(C`\*(C'\fR .SH BUGS .IX Header "BUGS" Please report any bugs or feature requests to \&\f(CW\*(C`bug\-html\-template\-pluggable@rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "Copyright & License" .IX Header "Copyright & License" Copyright 2006 Mark Stosberg, All Rights Reserved. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.