App::ZofCMS::Plugin::Sub - plugin to execute a subroutine, i.e. sub with priority setting
In your Main Config File or ZofCMS Template file:
plugins => [ { Sub => 1000 }, ], # set needed priority plug_sub => sub { my ( $template, $query, $config ) = @_; # do stuff }
The module is a plugin for App::ZofCMS that allows you to execute a sub... by setting plugin's priority setting you, effectively, can set the priority of the sub. Not much but I need this.
This documentation assumes you've read App::ZofCMS, App::ZofCMS::Config and App::ZofCMS::Template
plugins
plugins => [ { Sub => 1000 }, ], # set the needed priority here
You obviously need to add the plugin in the list of plugins to exectute. Since the entire purpose of this plugin is to execute the sub with a certain priority setting, you'd set the appropriate priority in the plugin list.
plug_sub
plug_sub => sub { my ( $template, $query, $config ) = @_; }
Takes a subref as a value. The plugin will not run unless plug_sub first-level key is present in either Main Config File or ZofCMS Template file. If the key is specified in both files, the sub set in ZofCMS Template will take priority. The sub will be executed when plugin is run. The @_ will contain (in that order): ZofCMS Template hashref, query parameters hashref where keys are parameter names and values are their values, App::ZofCMS::Config object.
@_
Fork this module on GitHub: https://github.com/zoffixznet/App-ZofCMS
To report bugs or request features, please use https://github.com/zoffixznet/App-ZofCMS/issues
If you can't access GitHub, you can email your request to bug-App-ZofCMS at rt.cpan.org
bug-App-ZofCMS at rt.cpan.org
Zoffix Znet <zoffix at cpan.org> (http://zoffix.com/, http://haslayout.net/)
You can use and distribute this module under the same terms as Perl itself. See the LICENSE file included in this distribution for complete details.
LICENSE
To install App::ZofCMS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::ZofCMS
CPAN shell
perl -MCPAN -e shell install App::ZofCMS
For more information on module installation, please visit the detailed CPAN module installation guide.