[Melbourne-pm] Help - I barely speak Camel.
Adam Clarke
adam.clarke at strategicdata.com.au
Tue Jul 25 04:42:58 PDT 2006
Hello Peter,
Peter Machell wrote:
> I need to develop a simple application and would like to do so in
> Perl. Is this list an appropriate place to ask questions about this
> with a view to better understanding and refining my code?
I'm no grand pooh-bah of melbourne.pm list etiquette however it sounds
like a pretty reasonable thing to be doing to me.
> I need to interface with a number of different databases to pull out
> some demographic information, feed this into an array, regex it to
> get the formatting right, then send it, and a message containing
> variables from this info, to an API for which I have a Perl example.
Sounds like a job for Perl, do you have any specific questions about
those steps?
> Returning from that API will be some debug, which I'd like to combine
> with the information and print out to a HTML file for reporting.
This sounds like a job for a templating module. Take a look at Template
Toolkit ...
http://www.template-toolkit.org/
http://search.cpan.org/~abw/Template-Toolkit-2.15/lib/Template.pm
... you want to abstract the markup generation from your code as early
as you can. If you find yourself printing out HTML from within Perl then
you should almost always be using some kind of templating solution.
> As I'm dealing with a number of different database engines, I figure
> I'll do the initial data mining using those engine's tools, and start
> the Perl code with pulling data from a CSV file. This seems easier to
> me than trying to get a DBI going for each engine and using Perl to
> do the queries.
If you can afford the time, I'd bite the bullet and try to get DBI
going. It will help keep all the stuff you are needing to do for this
job in one place. If you do decide to go the CSV route, don't try to
parse this yourself, see one of the Perl modules Text::CSV_XS (fast) or
Text::CSV_PP (slow) or better yet DBD::CSV and use the DBI to access
that gathered data. The latter option will allow you to move to direct
DBI access to your data more easily since the code will likely be very
similar.
Cheers
--
Adam Clarke
www.strategicdata.com.au
More information about the Melbourne-pm
mailing list