package Queries; use DBI; use strict; #we really don't care about this as we are not #going to instantiate a Queries object. Just its #children sub new { my $proto=shift; my $class=ref($proto) || $proto; my $self={}; bless $self,$class; # We'll just put this here for clarity $self -> init(); return $self; } sub init { my $self=shift; #modify this to suit your situation my $self->{dbh}=DBI->connect('DBI:mysql',"username" ,"password" ); } sub execute { my $self=shift; my @parms=@_; return unless $self->{dbh}; return unless $self->{sql}; $self->{sth}=$self->{dbh}->prepare($self->{sql}); } sub fetchrow_hashref { my $self=shift; return unless $self->{sth}; return $self->{sth}->fetchrow_hashref; }