The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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.

AUTHOR

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

BUGS

Please report any bugs or feature requests to bug-app-zofcms-plugin-sub at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=App-ZofCMS-Plugin-Sub. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc App::ZofCMS::Plugin::Sub

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2008 'Zoffix, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.