in reply to Best Coding practice

I usually create a module that does the database connections and a few other housekeeping chores and then I create modules that are derivitaves of that one. Example:

package dbObject; my is_connected=0; # important... my $dbh=undef; sub connect { | connection foo here... } sub prepare { my ($self,$sql) = @_; if ( ! is_connected) $self->connect; $self->{sth} = $dbh->prepare(....); } 1; package myTable; use vars qw / @ISA /; use dbObject; @ISA = qw/ dbObject /; #etc. 1;
and I have variations on that theme that I use. Lately rather than use DBI for my database layer I use Class::DBI::Loader which further encapulates the databse layer for me using a similar method where I have a "parent" class instantiate the loader and the "child" classes inherit it from there. In fact I'm working on a major project now that uses that methodology and other than some interesting bugs I've discovered in the way Class::DBI::Loader reacts to certain table names I've not had any problems.

Hope this helps...

UPDATE:Special thanks to GrandFather for pointing out my fat-fingering


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg