NAME
Template::Plugin::Handy - handy vmethods for Template Toolkit
SYNOPSIS
[% USE Handy;
mything.dump_data;
mything.dump_stderr;
mything.as_json;
%]
DESCRIPTION
Handy virtual methods I always use in my Template Toolkit files, especially for debugging.
METHODS
Only new or overridden method are documented here.
dump_data
Replacement for the Dumper plugin. You can call this method on any variable to see its Data::Dump representation in HTML-safe manner.
[% myvar.dump_data %]
dump_stderr
Like dump_data but prints to STDERR instead of returning HTML-escaped string. Returns undef.
as_json
Encode the variable as a JSON string. Wrapper around the JSON->encode method. The string will be encoded as UTF-8, and the special JSON flags for converted_blessed and allow_blessed are true
by default.
increment( n )
Increment a scalar number by one. Aliased as a scalar vmethod as 'inc'.
decrement( n )
Decrement a scalar number by one. Aliased as a scalar vmethod as 'dec'.
sort_by( method_name )
Sort an array or hash ref of objects according to method_name. The sort assumes a cmp
comparison and the return value of method_name is run through lc() first.
Returns a new sorted arrayref.
AUTHOR
Peter Karman, <karman@cpan.org>
BUGS
Please report any bugs or feature requests to bug-template-plugin-handy@rt.cpan.org
, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
ACKNOWLEDGEMENTS
The Minnesota Supercomputing Institute http://www.msi.umn.edu/
sponsored the development of this software.
COPYRIGHT & LICENSE
Copyright 2008 by the Regents of the University of Minnesota.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.