On Thu, 2 Sep 2004, Jamie Echlin wrote:

> I am having a small but irritating issue with the Data::Dumper plugin.
>
> I am using TT in a mod_perl environment, templates are processed by perl
> handlers.
>
> Within my templates I am in the habit of doing:
>
> USE Dumper(Indent=1, Pad="<br>");
> Dumper.dump ...
>
> The problem is that from the first time that's encountered, that Pad
> setting persists across all my handlers, including the ones that produce
> only plain text. I expect this behaviour is consistent with the
> environment, my question though is how can I localise that setting so
> that it does not affect other handlers, or, do I have to have to set
> $Data::Dumper::Pad in all my handlers?

Have you tried this:

  [% USE htmldumper = Dumper( Indent=1, Pad='<br>' ) %]
  [% USE textdumper = Dumper( Indent=1 ) %]

then later...

  [% htmldumper.dump( data ) %]   # should use the '<br>' padding
  [% textdumper.dump( data ) %]   # should not use the '<br>' padding

This is untested, but if I understand USE correctly, it should work.

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!
[EMAIL PROTECTED]                                  Dig it all.

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to