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::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 $q->{foo} =~ /\S/;

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 don't contain non-whitespace characters. 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()

AUTHOR

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

BUGS

Please report any bugs or feature requests to bug-app-zofcms-plugin-autoemptyquerydelete at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=App-ZofCMS-Plugin-AutoEmptyQueryDelete. 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::AutoEmptyQueryDelete

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2009 'Zoffix, all rights reserved.

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