Zoffix Znet > App-ZofCMS > App::ZofCMS::Plugin::AutoEmptyQueryDelete

Download:
App-ZofCMS-1.001004.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 1.001004   Source  

NAME ^

App::ZofCMS::Plugin::AutoEmptyQueryDelete - automatically delete empty keys from query parameters

SYNOPSIS ^

    plugins => [
        { AutoEmptyQueryDelete => 100 },
        # plugins that work on query parameters with larger priority value
    ],

DESCRIPTION ^

The module is a plugin for App::ZofCMS that I made after I got sick and tired of constantly writing this (where $q is query parameters hashref):

    do_something
        if defined $q->{foo}
            and length $q->{foo};

By simply including this module in the list of plugins to run, I can save a few keystrokes by writing:

    do_something
        if exists $q->{foo};

This documentation assumes you've read App::ZofCMS, App::ZofCMS::Config and App::ZofCMS::Template

WHAT DOES THE PLUGIN DO ^

The plugin doesn't do much, but simply delete()s query parameters that are not defined or are of zero length if they are. With that being done, we can use a simple exists() on a key.

USING THE PLUGIN ^

Plugin does not need any configuration. It will be run as long as it is included in the list of the plugins to run:

    plugins => [
        { AutoEmptyQueryDelete => 100 },
        # plugins that work on query parameters with larger priority value
    ],

Make sure that the priority of the plugin is set to run before your other code that would check on query with exists()

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.

syntax highlighting: