Skip to content

Commit

Permalink
new tip: Using Data::Printer with Template Toolkit (sdt++)
Browse files Browse the repository at this point in the history
  • Loading branch information
garu committed Jul 22, 2012
1 parent 5aa38ff commit 158fed3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/Data/Printer.pm
Expand Up @@ -1844,6 +1844,27 @@ In the example above, the C<$html_output> variable contains the
HTML escaped output of C<p($object)>, so you can print it for
later inspection or render it (if it's a web app).
=head2 Using Data::Printer with Template Toolkit
I<< (contributed by Stephen Thirlwall (sdt)) >>
If you use Template Toolkit and want to dump your variables using Data::Printer,
install the L<Template::Plugin::DataPrinter> module and load it in your template:
[% USE DataPrinter %]
The provided methods match those of C<Template::Plugin::Dumper>:
ansi-colored dump of the data structure in "myvar":
[% DataPrinter.dump( myvar ) %]
html-formatted, colored dump of the same data structure:
[% DataPrinter.dump_html( myvar ) %]
The module allows several customization options, even letting you load it as a
complete drop-in replacement for Template::Plugin::Dumper so you don't even have
to change your previous templates!
=head2 Unified interface for Data::Printer and other debug formatters
I<< (contributed by Kevin McGrath (catlgrep)) >>
Expand Down

0 comments on commit 158fed3

Please sign in to comment.