Re: [Templates] One more (hopefully the last this week :-)

[prev] [thread] [next] [Date index for 2004/07/21]

From: Mark Fowler
Subject: Re: [Templates] One more (hopefully the last this week :-)
Date: 10:48 on 21 Jul 2004
On Tue, 20 Jul 2004, Roderick A. Anderson wrote:

> On Tue, 20 Jul 2004, Darren Chamberlain wrote:
>
> > * Roderick A. Anderson <raanders at acm.org> [2004/07/20 17:50]:
> > > Is there a special trick to get at the keys and values SUI?
> >
> >   [% USE dumper; dumper.dump(SUI); %]
>
> Thanks Darren but damn can I screw things up!  I must have something
> _really_ wrong.  I get back.
>
> 	$VAR1 = '';

That's because Darren misread your request.  What he thought you'd written
is this:

  # pass everything in under the SUI key
  my $tt = Template->new();
  $tt->process("foo.tt2", { SUI => \%SUI })
   or die $tt->error;

Not

  # pass everything in as a top level
  my $tt = Template->new();
  $tt->process("foo.tt2", \%SUI )
   or die $tt->error;

What you really want to know in TT is a way of seeing every variable that
is defined in the stash at all.  I can't think of an easy way to do this
within TT.  You're not the first person to ask for this either (Tom Insam
asked about this a few months back iirc.)

From Perl space, this is fairly simply of course:

  # dump out what we've about to pass in
  use Data::Dumper;
  print STDERR Dumper(\%SUI);  # print to the apache log everything

  # pass everything in as a top level
  my $tt = Template->new();
  $tt->process("foo.tt2", \%SUI )
   or die $tt->error;

I hope that helps.

Mark.

        -- 
        #!/usr/bin/perl -T
use strict;
use warnings;
print q{Mark Fowler, mark@xxxxxxxxxxxxxx.xxx, http://twoshortplanks.com/};

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

[Templates] One more (hopefully the last this week :-)
Roderick A. Anderson 00:50 on 21 Jul 2004

Re: [Templates] One more (hopefully the last this week :-)
Darren Chamberlain 00:56 on 21 Jul 2004

Re: [Templates] One more (hopefully the last this week :-)
Roderick A. Anderson 01:19 on 21 Jul 2004

Re: [Templates] One more (hopefully the last this week :-)
Mark Fowler 10:48 on 21 Jul 2004

Re: [Templates] One more (hopefully the last this week :-)
Roderick A. Anderson 20:16 on 22 Jul 2004

RE: [Templates] One more (hopefully the last this week :-)
Thomas, Mark - BLS CTR 12:44 on 21 Jul 2004

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