Template::Plugin::DBI is on my list of modules to check out, but I've not yet worked with it. Does it allow you to specify a \%attr in the connect? If so, then this should work:
[% USE DBI(
'dbi:CSV:',undef,undef,
{ RaiseError => 1
, csv_tables =>
{ users => { file => 'c:/projekte/vdx/daten/users.txt'
, eol => "\n"
, col_names => ['id','name']
}
}
}
) -%]
If the module doesn't support setting \%attrs in the connect string, does it allow you to pass a pre-defined $dbh? If it supports neither, that seems pretty lame. That would be an issue which impacts more than DBD::CSV. OTOH in order to support \%attrs in a template probably requires a string eval which is pretty lame also. (Please don't take this as a criticism of the module, it's more of general remark on modules that support DBI connections but don't support setting \%attrs during connection). Hmm, a thought - if the templating plugin uses YAML, it could avoid string eval.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.