Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
In a template, I have this ...
<tmpl_var name="doc" default="this is the data for this run mode">
In a perl script, I have this ...
my $template = HTML::Template->new(filename => "$mode",
die_on_bad_params => 0, #SYSTEM
strict => 0, );
my $doc = $template->param( 'doc' );
From my tests, it seems as if the call to "param( 'doc' );" does not return
the value of a TMPL_VAR's "default" attribute.
The tests have been run on 2.6 HTML::Template, ActiveState Perl 5.6.1,
HTML::Template built from source with Visual Studio. I have included by
call to the HTML::Template constructor in case access to the default values
via param( ) is somehow controlled by new( ) arguments.
Thanks in advance.
Lead Web Application Developer
O'NEIL & ASSOCIATES, INC.
495 Byers Rd.
Miamisburg, Ohio 45342-3662
Phone: (937) 865-0800 ext. 3038
Fax: (937) 865-5858
From: Sam Tregar <sam@tr...> - 2003-05-29 04:14:15
On Wed, 28 May 2003, Cory Trese wrote:
> >From my tests, it seems as if the call to "param( 'doc' );" does not return
> the value of a TMPL_VAR's "default" attribute.
That's the intended behavior. If it worked differently you wouldn't
be able to tell the difference between a parameter already set and a
parameter with a default. For some applications the difference is
signficant. Also, being able to read the default value back from the
template would certainly be abused as a mechanism to allow the
template to pass data back into Perl, which is contrary to the
philosophy of HTML::Template.
However, that said, I should probably mention this in the param()