On 31 May 2007 06:17:50 -0700, Alma <[EMAIL PROTECTED]> wrote: snip
I am getting an error : Can't locate object method "prepare" via package "abc" at xyz.pm
snip
Besides the things that are wrong that other people have mentioned, you need to make the abc class a subclass of DBI. This being Perl there are several ways to do it, but I prefer to say package DBI::MySingleton; use strict; use Carp; use base 'DBI'; our $dbh; sub new { our $dbh; my ($class, $user, $pass) = @_; $user ||= "test"; $pass ||= "test123"; unless ($dbh and $dbh->ping) { $dbh = DBI->connect("DBI:Pg:dbname=mydb",$user,$pass, {PrintError =>1}) or croak DBI->errstr; bless $dbh, $class; } return $dbh; } sub DESTROY() { my $self = shift; $self->disconnect(); } 1; Or you could just use DBI->connect_cached() and save yourself a heap of trouble. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/