On Wed, Dec 11, 2002 at 10:45:03AM +0000, Marcos Rebelo wrote:
>Instead of using the ?defined? I can use the ?exists?. The problem is if the
>tmpl_var is inside a tmpl_loop.
>Can I have access to the tmpl_var there?
Yes.
It's time for me to post the template dumper again, isn't it? Run this
against a template, and you'll get a hierarchical list of the variables
in it. Extending this to test whether each variable is defined shouldn't
be particularly difficult; I haven't had a need to, so I haven't written
it.
#! /usr/bin/perl -w
use strict;
use HTML::Template;
my $t=HTML::Template->new(filename => $ARGV[0],
die_on_bad_params => 0);
my @l=$t->param;
my @o;
&output(0,\@o,\@l);
sub output {
my ($level,$oldref,$listref)=@_;
my @list=@{$listref};
my @old=@{$oldref};
foreach my $param (sort @list) {
my @k=@old;
push @k,$param;
print ' ' x $level;
print "$param\n";
if ($t->query('name' => \@k) eq 'LOOP') {
my @l=$t->query('loop' => \@k);
&output($level+1,\@k,\@l);
}
}
}
Roger
-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users