[Templates] Template::Plugin::DBI (DBI.tie bug)

Jeff Anderson captvanhalen@yahoo.com
Mon, 20 Oct 2003 07:13:20 -0700 (PDT)


DBI.tie can be quite nice, but i recentlly ran
into this problem:

[%
   USE Dumper;
   USE DBI('dbi:mysql:database:host', 'user',
'pass');
   sth = DBI.tie('genre','id');
   Dumper.dump(sth);
-%]

[% FOREACH key = sth.keys -%]
	* [% key %]
[% END -%]

The first Dumper.dump reveals that sth does
indeed contain data, but sth.keys is returning
undef. Here is another test i tried - i truncated
the data returned from Dumper.dump(sth) in my
above test and assigned it to sth:

[% sth = {
   '1' => {
      'id' => '1',
      'name' => 'Sci-Fi'
   },
   '2' => {
      'id' => '2',
      'name' => 'Horror'
   },
}; -%]

[% FOREACH key = sth.keys -%]
   * [% key %]
[% END -%]

Here sth.keys indeed returns a list. Any
thoughts? Think it's a bug? I tested this with
Template::Plugin::DBI version 2.57

Thanks,
jeffa

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com