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, [EMAIL PROTECTED], http://twoshortplanks.com/};

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

Reply via email to