Well do you have a db_connect subroutine defined for the PgSQL namespace?
It's telling you the exact problem.

Ilya

-----Original Message-----
From: Christine Kluka
To: Ronald J Kimball; Chase Michael A.
Cc: Neil Lunn; [EMAIL PROTECTED]
Sent: 6/21/01 6:14 AM
Subject: Re: DBI Connect Failure

Ron, Michael,

Thanks, using option 1, all the syntax errors are cleared up!  I'm not
too clear on where the print statements are needed, so if you could
refer me to some documentation about this,
I'd appreciate it.

However I still can't connect to my sample Postgres database.  

On:

package PgSQL;
use strict;
use PgSQL::Cursor;

use CGI qw(:standard);

my $dbh;
$dbh = db_connect("mydb") or die "Error: $PgSQL::error";
print $dbh;

I get:
"Undefined subroutine &PgSQL::db_connect called"

Thanks again for your help,

Christine

Ronald J Kimball wrote:
> 
> On Wed, Jun 20, 2001 at 03:47:31PM +0200, Christine Kluka wrote:
> > Neil,
> >
> > Thanks, I added "my" to this variable and to the array and hash
> > declarations in my "row" subroutine -- this eliminated the "not
> > imported" errors.
> >
> > Now when I execute the script I am prompted for explicit package
names
> > for each instance of a scalar, array or hash.  I believe that if I
> > declare the fully qualified package name where the database handler
is
> > invoked, this should take care of the problem.  I've tried several
ways
> > of doing this, but they all fail on syntax or for more serious
reasons.
> 
> That's another error that means you haven't declared your variables.
> 
> When you use strict 'vars', you have three options for each variable.
> 
> Declare it with my:
> 
>   my $lexical_variable;
>   $lexical_variable = 7;
>   print $lexical_variable;
> 
> Declare it with use vars:
> 
>   use vars qw/ $global_variable /;
>   $global_variable = 7;
>   print $global_variable;
> 
> Specify the package name every time you use it:
> 
>   $main::global_variable = 7;
>   print $main::global_variable;
> 
> Most people prefer the first two options.
> 
> Ronald

Reply via email to