Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??
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

In reply to Generic front end with back-end drivers? by toma

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.