Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

new tip: Using Data::Printer with Template Toolkit (sdt++)

  • Loading branch information...
commit 158fed3699ac9390ed7a44e57425b0fd0fd72322 1 parent 5aa38ff
@garu authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 lib/Data/Printer.pm
View
21 lib/Data/Printer.pm
@@ -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)) >>
Please sign in to comment.
Something went wrong with that request. Please try again.