Template::Plugin::Clone - clone objects within TT
[% USE Clone %] [% bar = Clone.clone(foo) %] [% USE CloneVMethods %] [% baz = foo.clone %]
Clones objects and datastructures from within the Template Toolkit using the dclone method from Storable. If the item passed to the function isn't a object or data structure then it is simply copied.
dclone
To access the clone function like a class method, simply use the plugin from within a Template Toolkit template:
clone
[% USE Clone %]
And then call the method against the Clone object.
[% bar = Clone.close(foo) %]
Alternatively you can load the function as vmethods:
[% USE CloneVMethods %] [% baz foo.clone %]
Using the VMethods plugin as above will cause the vmethods to be in effect for the current template and all templates called from that template. To allow all templates called from any instance of the Template module load the module from Perl with the 'install' parameter.
use Template::Plugin::CloneVMethods 'install';
Written by Mark Fowler <mark@twoshortplanks.com>
Copryright Mark Fowler 2003. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Main functionality imported from Storable, which was written by Raphael Manfredi <Raphael_Manfredi@pobox.com> and is now maintained by the perl5-porters >perl5-porters@perl.org<
None known.
Bugs should be reported to me via the CPAN RT system. http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Template-Plugin-Clone.
Storable Template::Plugin::Procedural Template::Plugin::VMethods
To install Template::Plugin::Clone, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Plugin::Clone
CPAN shell
perl -MCPAN -e shell install Template::Plugin::Clone
For more information on module installation, please visit the detailed CPAN module installation guide.