Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Dear Aristotle

It surprises me that this excellent study you shared with us (++) didn't take you to Class::DBI & friends. IMHO this approach is nicer because you simply do not see any more SQL mixed with your Perl. Granted, this may be a significant paradigm shift and perhaps there are things that get harder to do with this model.

The fact that no monks have mentioned this yet makes me think that there is something in your node that I missed :) But anyway, I would like to share my experience with the fellow monks.

With Class::DBI you write a (very simple) class hierarchy that describes your tables, columns, relationships. This can be even simpler if you accept to specify within those classes, which database you will be using. In this case you wouldn't even have to name your columns at all.

That class hierarchy really helps a lot with code reuse and encapsulation.

Then, all of a sudden, everything becomes nice, packaged objects with accessors that are mostly DWIM-compliant. There are additional classes that support complex query generation (even supplying your own SQL).

There are some wrinkles to iron yet, but in my experience, this family of modules has changed my way of working. I really like this style better and I have seen how cleaner your programs can be. I rewrote some production code (DNS::BL) so that it uses Class::DBI rather than hand rolled code, and I'm very happy with the results.

BTW, it also plays nice with Apache::DBI...

Best regards

-lem, but some call me fokat


In reply to Re: A brief survey of the DBI usability layer modules on the CPAN by fokat
in thread A brief survey of the DBI usability layer modules on the CPAN by Aristotle

Title:
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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-18 05:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found