Mathew Robertson wrote:

> Relating this to TMPL_LOOP's... the question becomes, "Is a variable inside 
> a loop considered to be equivalent to a hash key, or equivalent to a 
> variable?", alternatively it could be asked "What is the 'strict'ness of 
> TMPL_LOOP variables (as compared to Perl's use of 'strict'ness)?".
>  

According to the H::T docs ...
"For the computer-science geeks among you, a <TMPL_LOOP> introduces a new
scope much like a perl subroutine call."
So the scope (when global vars is turned on) is that it should behave like a
variable, not a hash (since it is a TMPL_VAR not a TMPL_KEY right :). For
instance, the following simple script..

#!/usr/bin/perl
use strict;
                                                                             
                                                                               
our $var = 'a test';
&test();
                                                                             
                                                                               
sub test
{
  my $var = 'another test';
  $var = undef;
  print "This is $var\n";
}

produces this output
'This is'

Even with 'use strict' (and even with 'use warnings' STDOUT still gets this
output even if STDERR get's the warning).

So, in my opinion he is right. This is a bug. And I even think sam admitted it
was and that somehow what was needed was to check 'exists' and not truthfulness.


> Since we are talking about TMPL_LOOP variables, not Perl hash keys, it gets
back to the question(s) posed above.
> 
> > Another example:
> > 
> > -- test.pl --
> > #!/usr/bin/perl
> > my $tvar = "this is a test";
> > $tvar = undef;
> > print "Tvar=$tvar\n";
> > -----------------------------------------
> > The above prints: Tvar=
> 
> true - but only if you dont do:
> 
> use strict;
> use warnings;

Even if you 'use strict' and 'use warnings' you get the right output (like I
said before, on STDOUT even if you do get a 'warning' on STDERR)


Michael Peters
Venzia


-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to