Templer::Plugin::Factory - A simple plugin class
This class implements a singleton within which plugin classes may be registered and retrieved.
The plugins used by templer are of two forms:
templer
These plugins operate upon the text contained in Templer::Site::Page objects and transform the input into HTML.
These plugins, also operating on Templer::Site::Page objects, are allowed the opportunity to modify, update, replace, or delete the various per-page variables.
Plugins of each type register themselves by calling the appropriate methods in this class.
This module is free software; you can redistribute it and/or modify it under the terms of either:
a) the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version, or
b) the Perl "Artistic License".
Steve Kemp <steve@steve.org.uk>
Copyright (C) 2012-2015 Steve Kemp <steve@steve.org.uk>.
This library is free software. You can modify and or distribute it under the same terms as Perl itself.
Constructor.
This class is a singleton, so this method will either construct an instance of this class or return the global instance.
This method loads "*.pm" from the given directory.
For each loaded plugin invoke the "init" method, if it exists.
This method should be called by all formatting plugins to register themselves. The two arguments are the name of the input-format, and the class-name which may be instantiated to process that kind of input.
Templer::Plugin::Textile and Templer::Plugin::Markdown are example classes.
This method should be called by all template filter plugins to register themselves. The two arguments are the name of the template-filter, and the class-name which may be instantiated to process that kind of input.
Templer::Plugin::Dollar and Templer::Plugin::Strict are example classes.
This method should be called by all variable-expanding plugins to register themselves. The expected argument is the class-name which may be instantiated to expand variables.
Templer::Plugin::ShellCommand, Templer::Plugin::FileGlob, and Templer::Plugin::FileContents are examples of such plugins.
NOTE: The plugin is instantiated immediately, and kept alive for the duration of a templer-run.
Expand variables via all loaded plugins.
For each loaded plugin invoke the "cleanup" method, if it exists.
This can be useful if you wish a plugin to generate a site-map, or similar.
Return a new instance of the formatter class with the given name.
undef is returned if no such plugin is registered.
undef
Return the names of each registered formatter-plugin, this is only used by the test-suite.
Return a new instance of the filter class with the given name.
Return the names of each registered filter-plugin, this is only used by the test-suite.
To install App::Templer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Templer
CPAN shell
perl -MCPAN -e shell install App::Templer
For more information on module installation, please visit the detailed CPAN module installation guide.