|We don't bite newbies here... much|
Generic front end with back-end drivers?by toma (Vicar)
|on Feb 12, 2008 at 17:04 UTC||Need Help??|
toma has asked for the
wisdom of the Perl Monks concerning the following question:
I am looking for any modules or advice about how to create a generic front end interface with a dynamic back end. I am thinking about something like DBI/DBD.
From the DBI pod:
The DBI "dispatches" the method calls to the appropriate driver for actual execution. The DBI is also responsible for the dynamic loading of drivers, error checking and handling, providing default implementations for methods, and many other non-database specific duties.
I am looking for a module or advice about the dynamic loading, error checking, or any other advice about creating a generic interface that has multiple back-end drivers.
My particular problem is that I am extracting similar data from about 20 different file formats. Some of them are platform-specific. A few of the parsers are quite heavy, and I would like to use dynamic driver loading. My existing module autodetects the file format and includes a parser for each format. Now I need to add some new formats and I would like to avoid loading all the parsers all the time.
The module gets used by different applications on different platforms. Some file formats are platform-specific. Some file formats only provide a subset of all the possible data, and I will support a subset of the whole API.
I could just write a DBD driver for the various file formats, but I am concerned about violating rules #1 and #2 of the DBD driver development guide.
It should work perfectly the first time! - toma