Thread: Postgresql Perl Problem

Postgresql Perl Problem

From
"HydroMan"
Date:
I am trying my first query a postgresql database using perl (using a Redhat
6.0 distribution).  The script fails on the line:

$conn=Pg::connectdb("dbname=mydatabase");

with the error 'Can't locate pg.pm in @INC.

I thought that I may have been missing the perl5 interface for postgres, and
tried to find one.  The linux documentation suggests the site
ftp://ftp.kciLink.com/pub/PostgresPerl-1.3.tar.gz, but its not there.  Can
anyone tell me if this missing intergace is the problem, and if it is, where
I can get PostgresPerl-1.3.tar.gz?

Thanx,
Jason






Re: Postgresql Perl Problem

From
Date:
I believe the PG modules come with the distribution.  However, if you
followed the instructions and installed postgres as and unpriveleged user
(postgres) then the install of pg.pm would fail since your Perl directory is
probably only writable by root.    Go back into your distribution directory
and cd into "src/utilities"  I don't have the structure in front of me but I
think there is a "Perl" directory there.  cd into that, su to root, and run
"make install".  That ought to do it.  If you don't have root privleges then
you can either add the following line to your perl script:   use lib "/path/to/pg.m_directory";

Or you can call perl with the "-I" option followed by the above path.  There
are other ways I'm sure. . .

Vince Daniels





Re: Postgresql Perl Problem

From
Vince Daniels
Date:
If you installed postgres as recommended as an unpriveleged user then
when you ran make install, the perl install would fail since your perl
lib directory is undoubtably owned by root.  The perl module does come
with the postgres distribution and can be found in the distribution
directory:
src/interfaces/perl5.  If you made postgres with the include perl option
then pg.pm is in that directory.  su to root and run make install from
that directory and you should be set.


-- 
Vince Daniels