Persistence-Object-Postgres
view release on metacpan or search on metacpan
Postgres.pm view on Meta::CPAN
use Data::Dumper;
use vars qw( $VERSION );
( $VERSION ) = '$Revision: 1.24 $' =~ /\s+([\d\.]+)/;
sub dbconnect {
my ($class, $dbobj) = @_;
my %options = (host => $dbobj->{Host} || '',
port => $dbobj->{Port} || '5432',
);
my $username = $dbobj->{Host} || (''.getpwuid $<);
my $password = $dbobj->{Host} || '';
my $options = join (';',"dbname=$dbobj->{Database}",
grep { /=.+$/ } map { "$_=$options{$_}" } keys %options);
return undef unless $dbh = DBI->connect("dbi:Pg:$options", $username, $password);
}
sub new {
my ($class, %args) = @_; my $self=undef;
return undef unless my $dope = $args{__Dope};
$self = $class->load (__Dope => $dope, __Oid => $args{__Oid} )
( run in 0.399 second using v1.01-cache-2.11-cpan-8d75d55dd25 )