App::ZofCMS::Plugin::AutoEmptyQueryDelete - automatically delete empty keys from query parameters
plugins => [ { AutoEmptyQueryDelete => 100 }, # plugins that work on query parameters with larger priority value ],
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):
$q
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
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.
delete()
exists()
Plugin does not need any configuration. It will be run as long as it is included in the list of the plugins to run:
Make sure that the priority of the plugin is set to run before your other code that would check on query with exists()
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.