Revision: 22183
http://gmod.svn.sourceforge.net/gmod/?rev=22183&view=rev
Author: scottcain
Date: 2009-10-21 15:08:41 +0000 (Wed, 21 Oct 2009)
Log Message:
-----------
adding a method to return a dsn string per Naama's request
Modified Paths:
--------------
schema/trunk/chado/lib/Bio/GMOD/DB/Config.pm
Modified: schema/trunk/chado/lib/Bio/GMOD/DB/Config.pm
===================================================================
--- schema/trunk/chado/lib/Bio/GMOD/DB/Config.pm 2009-10-20 21:54:47 UTC (rev 22182)
+++ schema/trunk/chado/lib/Bio/GMOD/DB/Config.pm 2009-10-21 15:08:41 UTC (rev 22183)
@@ -211,9 +211,7 @@
sub dbh {
my $self = shift;
- my $dsn = "dbi:Pg:dbname=".$self->name();
- $dsn .= ";host=".$self->host() if $self->host();
- $dsn .= ";port=".$self->port() if $self->port();
+ my $dsn = $self->dsn;
my $dbh = DBI->connect( $dsn, $self->user(), $self->password() )
or die "couldn't create db connection:$!";
@@ -222,7 +220,30 @@
return $dbh;
}
+=head2 dsn
+
+ Title : dsn
+ Usage : $dsn = $dbconf->dsn();
+ Function: return a database connection string
+ Returns : see above
+ Args : none
+ Status : Public
+
+=cut
+
+sub dsn {
+ my $self = shift;
+
+ my $dsn = "dbi:Pg:dbname=".$self->name();
+ $dsn .= ";host=".$self->host() if $self->host();
+ $dsn .= ";port=".$self->port() if $self->port();
+
+ return $dsn;
+}
+
+
+
1;
=head1 AUTHOR
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|