Cant get Perl Module loaded
I have installed perl and postgres, followed the instructions on how to
install the perl modules and tried to run a simple cgi script to connect to
postgress, get some data and display it.
I keep getting a message in the error log that says perl can't find the
DBM:Pg module or maybe I misspelled it. I also tried to "include" Pg.pm and
it says it cant find the module. I did a manual find and it is there.
Can any tell me what I am doing wrong or what I need to do to get postgres
working with perl?
Thanks,
-John
John writes:
I keep getting a message in the error log that says perl can't find the
DBM:Pg module or maybe I misspelled it. I also tried to "include" Pg.pm and
it says it cant find the module. I did a manual find and it is there.
This is no help unless you show the actual script and the actual error
message.
--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter
On Sun, May 20, 2001 at 12:48:48PM +0000, John wrote:
I have installed perl and postgres, followed the instructions on how to
install the perl modules and tried to run a simple cgi script to connect to
postgress, get some data and display it.I keep getting a message in the error log that says perl can't find the
DBM:Pg module or maybe I misspelled it. I also tried to "include" Pg.pm and
it says it cant find the module. I did a manual find and it is there.
Spelling things correctly (like DBD::Pg) and including the full error
messages would be helpful. Also, there's a difference between Pg and
DBD::Pg.
1) What output does this produce:
perl -e 'use DBI; print join("\n", DBI->available_drivers), "\n"'
2) Do you get an error when you execute:
perl -e 'use DBD::Pg'
3) What steps did you follow to install DBD::Pg?
Cheers,
Neil
Yes I posted a bunch of stuff way to hastily and was not clear. I ran
perl -e 'use DBD::Pg' and got this:
perl -e 'use DBD::Pg'
Can't locate DBD/Pg.pm in @INC (@INC contains:
/usr/lib/perl5/5.00503/i586-linux /usr/lib/perl5/5.00503
/usr/lib/perl5/site_perl/5.005/i586-linux /usr/lib/perl5/site_perl/5.005 .)
at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
I did a find as follows:
joro@natascha:/usr/lib/perl5 > find . -name "Pg.pm" -print
./site_perl/5.005/i586-linux/Pg.pm
so the Pg.pm file is in the scripts search path and yet....!?
Anyway to make the original post more complete, I was running a cgi script
as follows:
#!/usr/bin/perl
use Pg;
use DBI;
use CGI qw/:standard/;
$q = new CGI;
print $q->header;
my($dbh)="";
my($datasource)="dbi:Pg:infoman";
$dbh=DBI->connect($datasource) or die "Can't connect\n";
$sth = $dbh->prepare("SELECT Name from Platform");
$sth->execute();
@PLATOPTS=$sth->fetchrow_array();
.
.
.
#After doing some HTML I now try to create the a drop down
print "<p align=\"left\">Platform Selected<select size=\"1\" name=\"PlatID\"
multiple>\n";
foreach $appoption (@PLATOPTS){
print "<option>$platoption</option>\n";
}
Then finish the HTML ...etc.
I get this output:
install_driver(Pg) failed: Can't locate DBD/Pg.pm in @INC (@INC contains:
/usr/lib/perl5/5.00503/i586-linux /usr/lib/perl5/5.00503
/usr/lib/perl5/site_perl/5.005/i586-linux /usr/lib/perl5/site_perl/5.005 .)
at (eval 5) line 3.
Perhaps the DBD::Pg perl module hasn't been fully installed,
or perhaps the capitalisation of 'Pg' isn't right.
Available drivers: ADO, ExampleP, Multiplex, Proxy.
at /usr/local/apache/cgi-bin/vuladd.cgi line 23
I am not sure if I was supposed to compile perl into the posgresql or
postgresql into my perl. Anyway I went to the src directory and followed the
instructions for make install in the postgresql/src/interfaces/perl5
directory and everything seems fine. the permissions are:
joro@natascha:/usr/lib/perl5/site_perl/5.005/i586-linux > ls -l Pg.pm
-r--r--r-- 1 root root 18124 May 23 21:32 Pg.pm
If this is not enough information please tell me what else to post. Thanks
for helping me as I am struggling.
-John
"Neil Conway" <nconway@klamath.dyndns.org> wrote in message
news:20010522182623.A348@klamath.dyndns.org...
On Sun, May 20, 2001 at 12:48:48PM +0000, John wrote:
I have installed perl and postgres, followed the instructions on how to
install the perl modules and tried to run a simple cgi script to connect
to
postgress, get some data and display it.
I keep getting a message in the error log that says perl can't find the
DBM:Pg module or maybe I misspelled it. I also tried to "include" Pg.pm
and
Show quoted text
it says it cant find the module. I did a manual find and it is there.
Spelling things correctly (like DBD::Pg) and including the full error
messages would be helpful. Also, there's a difference between Pg and
DBD::Pg.1) What output does this produce:
perl -e 'use DBI; print join("\n", DBI->available_drivers), "\n"'
2) Do you get an error when you execute:
perl -e 'use DBD::Pg'
3) What steps did you follow to install DBD::Pg?
Cheers,
Neil
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
On Thu, May 24, 2001 at 01:33:46AM +0000, John wrote:
Yes I posted a bunch of stuff way to hastily and was not clear. I ran
perl -e 'use DBD::Pg' and got this:perl -e 'use DBD::Pg'
Can't locate DBD/Pg.pm in @INC (@INC contains:
/usr/lib/perl5/5.00503/i586-linux /usr/lib/perl5/5.00503
/usr/lib/perl5/site_perl/5.005/i586-linux /usr/lib/perl5/site_perl/5.005 .)
at -e line 1.
BEGIN failed--compilation aborted at -e line 1.I did a find as follows:
joro@natascha:/usr/lib/perl5 > find . -name "Pg.pm" -print
./site_perl/5.005/i586-linux/Pg.pm
DBD::Pg and Pg.pm are completely different. The former is the Postgres
driver for DBI, the later is a Perl interface to libpq. The file you
have installed is the later, but your code is trying to use the
former.
To install DBD::Pg, download it from CPAN. Alternatively, use Pg.pm
instead -- see `perldoc Pg` for more info (although I would recommend
DBI, it's nicer IMHO).
Cheers,
Neil
On Mon, May 28, 2001 at 08:55:44PM -0400, Neil Conway wrote:
On Thu, May 24, 2001 at 01:33:46AM +0000, John wrote:
Yes I posted a bunch of stuff way to hastily and was not clear. I ran
perl -e 'use DBD::Pg' and got this:perl -e 'use DBD::Pg'
Can't locate DBD/Pg.pm in @INC (@INC contains:
/usr/lib/perl5/5.00503/i586-linux /usr/lib/perl5/5.00503
/usr/lib/perl5/site_perl/5.005/i586-linux /usr/lib/perl5/site_perl/5.005 .)
at -e line 1.
BEGIN failed--compilation aborted at -e line 1.I did a find as follows:
joro@natascha:/usr/lib/perl5 > find . -name "Pg.pm" -print
./site_perl/5.005/i586-linux/Pg.pmDBD::Pg and Pg.pm are completely different. The former is the Postgres
driver for DBI, the later is a Perl interface to libpq. The file you
have installed is the later, but your code is trying to use the
former.To install DBD::Pg, download it from CPAN. Alternatively, use Pg.pm
instead -- see `perldoc Pg` for more info (although I would recommend
DBI, it's nicer IMHO).
for that, try
perl -MCPAN -e shell
and then
install DBD::Pg
which /should/ make everything all sparkly. if not, you'll have
to do some poking around until you hit on the right incantation.
:}
--
#95: We are waking up and linking to each other. We are watching. But
we are not waiting. -- www.cluetrain.com
will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!