rhj4 has asked for the wisdom of the Perl Monks concerning the following question:

I am a C#/SQL Server programmer tasked with converting an ancient Perl/Posgtres website into C#. I have been programming for many years and in many languages, but never in Perl and I am having some challenges getting started.

I have downloaded and installed Postgresql 9.0 on my desktop and populated it with data from the production site which is on a machine that could die any day. I have written some test code in C# using Npgsql that successfully accesses data in that database, but I have encountered problems using PGAdmin III and psql. Both appear flakey or improperly configured (highly likely).

I have installed ActiveState 6.0.3 and Strawberry Perl and I am attempting to get started, but hit a wall quickly. The code below fails on the “use Pg;” line. I have located several versions of this file, but none that seems to meet the approval of the compiler. I think the problem involves four variables:

Can you tell me what version of Pg I should install and where to put it in the code base?

require "PAQ.cfg";
require "";
use CGI qw(:standard);

$q = new CGI;

Replies are listed 'Best First'.
Re: Perl, Postgres and Windows
by syphilis (Chancellor) on Jan 17, 2011 at 20:12 UTC
    You don't mention what perl version you have, but the following are available via ppm for perl-5.12, either from the ActiveState repo, or the trouchelle repo (or, in some cases, both):

    DBD::PgPP, Pg::CLI, Pg::Explain, Pg::Loader, Pg::Priv.

    I don't know anything about Postgres, but I would think that it's the first in that list that gives you the driver you need. So, start with:
    ppm install DBD-PgPP
    and then 'ppm install' the others if they might also be useful.

Re: Perl, Postgres and Windows
by stefbv (Curate) on Jan 18, 2011 at 05:17 UTC

    DBD::PgPP is the "Pure Perl" PostgreSQL driver, to be used when is no other choice, better use DBD::Pg, which is installed by default in ActiveState Perl 5.12.2 build 1203, and in Strawberry Perl.

    Regards, Stefan

Re: Perl, Postgres and Windows
by Limbic~Region (Chancellor) on Jan 18, 2011 at 11:35 UTC
    I have successfully used Pg and PGAdmin on various different windows for a couple of years without issue. I also have never used Pg - it was last updated 11 years ago. I don't know what issue you are having with PGAdmin but I am quite sure your issue with your code are that you are not using DBD::Pg. I don't want to knock C# but my guess is that if the project had been kept up to date, it would probably not be necessary to migrate now.

    Cheers - L~R

      Original developer could not keep up with code. He died. Company sold, and years later, I inherit the problem. I am still facing newbie-itis with perl. I have no difficulty with strongly typed languages, but others like perl and JavaScript give me headaches. The issue with PGAdmin III is that when I click the SQL button, the program locks up tight. No way out. Have to kill it and restart. Gives me lots of confidence in the code...