Re: [Templates] correct usage of Dumper plugin

[prev] [thread] [next] [Date index for 2004/09/02]

From: Dave Cash
Subject: Re: [Templates] correct usage of Dumper plugin
Date: 16:51 on 02 Sep 2004
On Thu, 2 Sep 2004, Jamie Echlin wrote:

> Someone else has also suggested that - it doesn;t actually seem to work
> but I'm assuming it's because there is some hidden USE Dumper that I
> haven't found, and it does work.

Jamie,

OK, sorry for the poorly researched reply.  How about this?

  [% USE Dumper( Indent=0 ) %]

then later in your HTML:

  [% Dumper.dump_html( data ) %]

and somewhere in your plain text:

  [% Dumper.dump( data ) %]

The difference between dump and dump_html is just the addition of
these transformations in dump_html:

  s/&/&/g;
  s/</&lt;/g;
  s/>/&gt;/g;
  s/\n/<br>\n/g;

Which all seem like things you would want to happen when dumping to
a browser.

BTW, it seems like the reason my previous suggestion doesn't work is
because setting the Indent and Pad via the constructor seem to be
setting the correlating $Data::Dumper::Indent and $Data::Dumper::Pad
values globally, which will affect ever Template::Plugin::Dumper
object.  I imagine that's one of the reasons why the author created
a dump_html method.

Hope that helps,

Dave

/L\_/E\_/A\_/R\_/N\_/T\_/E\_/A\_/C\_/H\_/L\_/E\_/A\_/R\_/N\
Dave Cash                              Power to the People!
Frolicking in Fields of Garlic               Right On-Line!
dave@xxxxx.xxx                                  Dig it all.

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

(message missing)

Re: [Templates] tpage extension
Myk Melez 14:00 on 29 Aug 2004

Re: [Templates] tpage extension
Johan Vromans 15:07 on 29 Aug 2004

Re: [Templates] tpage extension
Andy Wardley 07:03 on 02 Sep 2004

Re: [Templates] tpage extension
Andy Wardley 07:42 on 02 Sep 2004

Re: [Templates] tpage extension
slaven 08:37 on 02 Sep 2004

Re: [Templates] tpage extension
Dylan Hardison 13:06 on 03 Sep 2004

[Templates] correct usage of Dumper plugin
Jamie Echlin 16:04 on 02 Sep 2004

Re: [Templates] correct usage of Dumper plugin
Jamie Echlin 16:39 on 02 Sep 2004

Re: [Templates] correct usage of Dumper plugin
Darren Chamberlain 16:45 on 02 Sep 2004

Re: [Templates] correct usage of Dumper plugin
Dave Cash 16:51 on 02 Sep 2004

Re: [Templates] correct usage of Dumper plugin
Jamie Echlin 17:33 on 02 Sep 2004

Generated at 08:56 on 15 Mar 2005 by mariachi v0.52