3. Has anyone developed a generic class based on Class::DBI that supports
"codes tables". Up until adopting DBI.pm, I always rely on a generic codes
table to store fairly static application decodes that really don't need
their own table. Some of the codes are keyed on language (error message
decode) and also have an effective date (e.g. new menu option). Primary key
is type/code/lang/effective date.
Here are a few rows from one which is probably a better illustration. +----------+------+----------+------------+------------+ | type | code | language | edate | decode | +----------+------+----------+------------+------------+ | sex | M | EN | 2001-09-01 | Male | | sex | F | EN | 2001-09-01 | Female | | entity | M | EN | 2001-09-01 | Member | | entity | O | EN | 2001-09-01 | Opposition | | entity | V | EN | 2001-09-01 | Venue | | contact | th | EN | 2001-09-01 | Home | | contact | tw | EN | 2001-09-01 | Work | | contact | tm | EN | 2001-09-01 | Mobile | | contact | fh | EN | 2001-09-01 | Home Fax | | contact | fw | EN | 2001-09-01 | Work Fax | | contact | em | EN | 2001-09-01 | Email | | contact | ct | EN | 2001-09-01 | Club Tel | | contact | cf | EN | 2001-09-01 | Club Fax | | language | en | EN | 2001-09-01 | English | | language | nl | EN | 2003-09-01 | Dutch | +----------+------+----------+------------+------------+
My aim would be to be able to access the "decode" directly from the
HTML::Template by declaring a relationship solely in the Class::DBI. E.g.
error decode message in from ValidateRM and labels for fields in the
original forms themselves.
For point 3 and direct access from the template, have you looked at Template Toolkit? I find it richer and more intuitive than HTML::Template, but I imagine the same can be done using HTML::Template. However, with TT, you could develop a simple function to do the mapping how you see fit and pass it as a coderef to Template Toolkit. In fact, if you encode your "decode" table (sorry about all the "codes") as a module, you can access the methods directly from your template. See here for examples and, in particular, use of a coderef:
http://www.template-toolkit.org/docs/blue/Tutorial/ Web.html#DYNAMIC_CONTENT_GENERATION_VIA_CGI_SCRIPT
I'm not sure if this directly addresses your question, but hope it helps, anyway.
Sean
--------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
