ok, solved it

http://search.cpan.org/~merlyn/Template-Plugin-DBM-Deep-0.02/lib/Template/Plugin/DBM/Deep.pm

"Caution: VMethods do not work against the hash-like or array-like
objects. However, you can use the export method to get an unattached
cloned copy of that portion of the database, and then the normal
vmethods work:

 "$key\n" FOR key IN db.export.keys;

Failure to export first will result in attempting to access a hash
element called keys, which doesn't exist."

silly me .. :-)

On 7/8/07, Daniel McBrearty <[EMAIL PROTECTED]> wrote:
Hi,

I'm posting this to the cat list and the TT list as it seems to be of
interest to both groups of users.

I have a hash which is made persistent with DBM::Deep. I pass the hash
straight through the controller to the template  (  $c->stash->{hash}
= $h; ), then iterate like this:

[%- FOREACH k in hash.keys -%]

<p> [%- k -%] </p>

[%- END -%]

I also dump the hash with $c->log->dumper in the controller, and see this:

[debug] $VAR1 = bless( {}, 'DBM::Deep::Hash' );

so I know an empty blessed hash is being passed.

But in the html out, I see :

<p> keys </p>

If I patch the controller so $c->stash->{hash} = {};

the problem goes away.

Is this some TT bug that interacts with DBM::Hash ? autovivifying
"keys" as a key not a function?

thanks

Daniel




--
Daniel McBrearty
email : danielmcbrearty at gmail.com
http://www.engoi.com
http://danmcb.vox.com
http://danmcb.blogger.com
find me on linkedin and facebook
BTW : 0873928131



--
Daniel McBrearty
email : danielmcbrearty at gmail.com
http://www.engoi.com
http://danmcb.vox.com
http://danmcb.blogger.com
find me on linkedin and facebook
BTW : 0873928131

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

Reply via email to