The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::ZofCMS::Plugin::Sub - plugin to execute a subroutine, i.e. sub with priority setting

SYNOPSIS

In your Main Config File or ZofCMS Template file:

    plugins => [ { Sub => 1000 }, ], # set needed priority
    plug_sub => sub {
        my ( $template, $query, $config ) = @_;
        # do stuff
    }

DESCRIPTION

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

MAIN CONFIG FILE AND ZofCMS TEMPLATE FIRST-LEVEL KEYS

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.

REPOSITORY

Fork this module on GitHub: https://github.com/zoffixznet/App-ZofCMS

BUGS

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

AUTHOR

Zoffix Znet <zoffix at cpan.org> (http://zoffix.com/, http://haslayout.net/)

LICENSE

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.