NAME

Template::Plugin::StringDump - String::Dump plugin for TT

VERSION

This document describes Template::Plugin::StringDump version 0.02.

SYNOPSIS

Template:

[% USE StringDump %]

[% SET msg = 'Ĝis! ☺' %]

hex: [% msg | dump %]
dec: [% msg | dump('dec') %]
oct: [% msg | dump('oct') %]
bin: [% msg | dump('bin') %]
names: [% msg | dump('names') %]

Output:

hex: 11C 69 73 21 20 263A
dec: 284 105 115 33 32 9786
oct: 434 151 163 41 40 23072
bin: 100011100 1101001 1110011 100001 100000 10011000111010
names: LATIN CAPITAL LETTER G WITH CIRCUMFLEX, LATIN SMALL LETTER I,
LATIN SMALL LETTER S, EXCLAMATION MARK, SPACE, WHITE SMILING FACE

The output has been manually split into multiple lines for the layout of this document.

DESCRIPTION

This Template::Toolkit plugin adds the dump filter, which dumps strings of characters or bytes for display and debugging. This filter is a simple wrapper around the dumpstr function from the String::Dump module. The filter takes the dumpstr mode as an optional argument, defaulting to hex. See String::Dump for details.

The filter name dump was selected instead of dumpstr because filters only work on strings, so the name would be repetitive. It also doesn't compete with other TT plugins like Template::Plugin::Dump or Template::Plugin::Dumper because they need to function on data structures, as opposed to strings, so they don't provide filters.

AUTHOR

Nick Patch <patch@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2011 Nick Patch

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