[Templates] Getting keys from a hash

Harald Joerg harald.joerg at fujitsu-siemens.com
Tue Feb 26 11:34:23 GMT 2008


Karl Dane <karl at rince.net> writes:

> Right! So - there's something REALLY weird going on here...
>
> To answer Simon, cgihash is from perl's CGI lib: my $cgi = new CGI; my
> $cgihash = $cgi->Vars;

Ouch.  So there *is* indeed something special about $cgihash:  It is
a tied hash, tied to the CGI object itself.  That's how Vars happens
to be implemented in CGI.pm.

Tied variables behave strange in some aspects, and I guess this is one
of them.  I think that TT gets stuck when trying to find out whether
cgihash is an object which implements a 'keys' method or a hash which
should respond to the 'keys' vmethod.

You should be able to get rid of the nuisance by copying your cgihash
to an explicit hash before use.
-- 
Cheers,
haj




More information about the templates mailing list