Getting started with Perl & Postgres in Windows 7

Bob Jones <[email protected]> Tue, 18 Jan 2011 08:11:48 -0800
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>
Good morning,

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:


1)      Version of ActiveState Komodo product (6.0.3)

2)      Version of Perl compiler (perl 5, version 12, subversion 2 (V5.12.2) built for MSWin32-x64-multi-thread, according to command line "perl -v")

3)      Version of Postgresql (9.0)

4)      Version of Pg.pm ???

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

Thanks,

Bob Jones
[email protected]
(360) 733-5500 X209


#!/usr/bin/perl
require "PAQ.cfg";
require "PAQ_include.pl";
use CGI qw(:standard);
use Pg;

$q = new CGI;

$stat = &Verify_UserName($ENV{REMOTE_USER});
print $q->header;
                &Log("paq_database.cgi",1, "just after header");
print $q->start_html(-title=>'Welcome to PAQ Database',
                -BGCOLOR=>'#FFFFFF',
                -onLoad=>"top.frames[0].location='/cgi-bin/Menu.cgi?CustN=$CustN&'");
                &Log("paq_database.cgi",1,"just after start_html");


                print $q->start_multipart_form("POST","/cgi-bin/Menu.cgi","TARGET=DisplayArea1");
                &Log("paq_database.cgi",1,"just after multipart_form");

                print "<CENTER>";
                print $q->h1("Welcome $ENV{REMOTE_USER} to your PAQ Database");
                &Log("paq_database.cgi",1,"just after Welcome");
                print "<CENTER>";

                print $q->end_form;
                print $q->end_html;
                &Log("paq_database.cgi",1,"Done!");