pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Quick perl question
6+ messages / 4 participants
[nested] [flat]

* Quick perl question
@ 2000-03-03 03:44 bweaver@tranquility.net
  0 siblings, 0 replies; 6+ messages in thread

From: bweaver@tranquility.net @ 2000-03-03 03:44 UTC (permalink / raw)
  To: pgsql-interfaces

Hey all,

I probably totally missed the docs on it, but I put PostgreSQL on 
my FreeBSD 3.4 box and I wanted to use some CGI scripts written 
in perl.  I installed Postgre 6.5.3 using the commands 'make 
USE_PERL=yes' and then 'make install'.  The installation is fine, 
but when I tried to make perl scripts using the Pg.pm library, I keep 
getting a "Can't locate Pg.pm in @INC..."

I'm using perl5.  Did I do something in the installation incorrectly?

An example script would be: 

#!/usr/bin/perl5 -w

use Pg;

# then the rest of the script goes here.

Thanks in advance,

-Ben



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Quick perl question
@ 2000-03-03 05:25 bweaver@tranquility.net
  2000-03-03 15:48 ` Re: [INTERFACES] Quick perl question Ed Loehr <eloehr@austin.rr.com>
  0 siblings, 1 reply; 6+ messages in thread

From: bweaver@tranquility.net @ 2000-03-03 05:25 UTC (permalink / raw)
  To: pgsql-interfaces

Hey all,

I probably totally missed the docs on it, but I put PostgreSQL on 
my FreeBSD 3.4 box and I wanted to use some CGI scripts written 
in perl.  I installed Postgre 6.5.3 using the commands 'make 
USE_PERL=yes' and then 'make install'.  The installation is fine, 
but when I tried to make perl scripts using the Pg.pm library, I keep 
getting a "Can't locate Pg.pm in @INC..."

I'm using perl5.  Did I do something in the installation incorrectly?

An example script would be: 

#!/usr/bin/perl5 -w

use Pg;

# then the rest of the script goes here.

Thanks in advance,

-Ben



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [INTERFACES] Quick perl question
  2000-03-03 05:25 Quick perl question bweaver@tranquility.net
@ 2000-03-03 15:48 ` Ed Loehr <eloehr@austin.rr.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Ed Loehr @ 2000-03-03 15:48 UTC (permalink / raw)
  To: bweaver@tranquility.net; +Cc: pgsql-interfaces

bweaver@tranquility.net wrote:
> 
> Hey all,
> 
> I probably totally missed the docs on it, but I put PostgreSQL on
> my FreeBSD 3.4 box and I wanted to use some CGI scripts written
> in perl.  I installed Postgre 6.5.3 using the commands 'make
> USE_PERL=yes' and then 'make install'.  The installation is fine,
> but when I tried to make perl scripts using the Pg.pm library, I keep
> getting a "Can't locate Pg.pm in @INC..."
> 
> I'm using perl5.  Did I do something in the installation incorrectly?

This probably doesn't answer your immediate question, but it might
render it irrelevant.  You may want to look into the perl DBI module
at CPAN along with DBD::Pg.  DBI is very clean and is the standard
means for accessing RDBMS (including postgres) from perl.

Cheers,
Ed Loehr



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [INTERFACES] Quick perl question
@ 2000-03-06 11:37 Karan Bhalla <karan_bhalla@hotmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Karan Bhalla @ 2000-03-06 11:37 UTC (permalink / raw)
  To: bweaver@tranquility.net; +Cc: pgsql-interfaces


Hi there,
	I agree that you should be using DBI...
That would help you use the same perl scripts for connecting to any other 
SQL compliant RDBMS with only the change of the DBD , table , user names.
Also you would'nt have to remember how to connect to different databases.

As far as your immediate problem is concerned.... I think you will be
getting a list of paths in @INC ... you should place your PG.pm file
in that list of paths..and all will end well..

CHEERS!!


>From: bweaver@tranquility.net
>To: pgsql-interfaces@postgreSQL.org
>Subject: [INTERFACES] Quick perl question
>Date: Thu, 2 Mar 2000 23:25:07 -0600
>
>Hey all,
>
>I probably totally missed the docs on it, but I put PostgreSQL on
>my FreeBSD 3.4 box and I wanted to use some CGI scripts written
>in perl.  I installed Postgre 6.5.3 using the commands 'make
>USE_PERL=yes' and then 'make install'.  The installation is fine,
>but when I tried to make perl scripts using the Pg.pm library, I keep
>getting a "Can't locate Pg.pm in @INC..."
>
>I'm using perl5.  Did I do something in the installation incorrectly?
>
>An example script would be:
>
>#!/usr/bin/perl5 -w
>
>use Pg;
>
># then the rest of the script goes here.
>
>Thanks in advance,
>
>-Ben
>
>************
>

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Quick perl question
@ 2000-03-06 17:56 Mark Dalphin <mdalphin@amgen.com>
  2000-03-06 20:33 ` Re: [INTERFACES] Re: Quick perl question Ed Loehr <eloehr@austin.rr.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Mark Dalphin @ 2000-03-06 17:56 UTC (permalink / raw)
  To: pgsql-interfaces; +Cc: bweaver@tranquility.net

Hi Ben,

Just a guess, but I suspect your installation went "slightly wrong".  When you
"make install" PostgreSQL, you do it as User "postgres".  It turns out that User
postgres does not have the required "root" permission to install Perl
extensions.  If you read thru your "make install log" carefully, you'll probably
see an error message to that effect just after the attempted install of Pg.pm.

I also would like to echo the comments that someone else has made about using
DBI::DBD rather than Pg.  Pg works well and is slightly easier to get working,
but that is because the complexity of DBI::DBD adds some useful stuff not
present in Pg. In particular, the error trapping is great. On the down side, it
gets tedious writting each query as two parts: "prepare" and "execute".  This is
compensated for in overall portability to other DBMS, I think.

You also need root permission to install DBI::DBD.

> I probably totally missed the docs on it, but I put PostgreSQL on
> my FreeBSD 3.4 box and I wanted to use some CGI scripts written
> in perl.  I installed Postgre 6.5.3 using the commands 'make
> USE_PERL=yes' and then 'make install'.  The installation is fine,
> but when I tried to make perl scripts using the Pg.pm library, I keep
> getting a "Can't locate Pg.pm in @INC..."
>
> I'm using perl5.  Did I do something in the installation incorrectly?
>
Mark Dalphin




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [INTERFACES] Re: Quick perl question
  2000-03-06 17:56 Re: Quick perl question Mark Dalphin <mdalphin@amgen.com>
@ 2000-03-06 20:33 ` Ed Loehr <eloehr@austin.rr.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Ed Loehr @ 2000-03-06 20:33 UTC (permalink / raw)
  To: bweaver@tranquility.net; +Cc: pgsql-interfaces

> I also would like to echo the comments that someone else has made about using
> DBI::DBD rather than Pg.  Pg works well and is slightly easier to get working,
> but that is because the complexity of DBI::DBD adds some useful stuff not
> present in Pg. In particular, the error trapping is great. On the down side, it
> gets tedious writting each query as two parts: "prepare" and "execute".  This is
> compensated for in overall portability to other DBMS, I think.

You may also avoid that downside by encapsulating prepare() and
execute(), eg. 

	sub mySelect {
	    ...
	    prepare...
	    execute...
	    ...
	}

Regards,
Ed Loehr



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2000-03-06 20:33 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-03-03 03:44 Quick perl question bweaver@tranquility.net
2000-03-03 05:25 Quick perl question bweaver@tranquility.net
2000-03-03 15:48 ` Ed Loehr <eloehr@austin.rr.com>
2000-03-06 11:37 Re: [INTERFACES] Quick perl question Karan Bhalla <karan_bhalla@hotmail.com>
2000-03-06 17:56 Re: Quick perl question Mark Dalphin <mdalphin@amgen.com>
2000-03-06 20:33 ` Ed Loehr <eloehr@austin.rr.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox