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. 
Here's my latest attempt:

#!/usr/local/bin/perl

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

use CGI qw(:standard);

#General variables

$packageName = "PgSQL";
$dbh = "Defined in $packageName";
print "In $packageName, $PgSQL, $dbh\n";
print "In $packageName, $main::$PgSQL\n";

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

Help!  Thanks,

Christine
 

Neil Lunn wrote:
> 
> >-----Original Message-----
> >From: Christine Kluka [mailto:[EMAIL PROTECTED]]
> >Sent: Wednesday, June 20, 2001 8:25 PM
> >To: Ronald J Kimball
> >Cc: [EMAIL PROTECTED]
> >Subject: Re: DBI Connect Failure
> >
> >
> >Ronald,
> >
> >Thanks for your reply. I:
> >- declared $i=0; -- it still fails to import
> 
> That means this:
>       for (my $i=0; $i<$nfields; $i++) {
>             ^^
> 
> that's declaring a variable and it is a requirement of the 'use strict'
> pragma.
> 
> Neil
> 
> >I've tried various other things, like
> >- declaring $i as <STDIN>, then chomping it -- same result
> >- using code from
> >http://www.perl.com/pub/1999/10/DBI.html#About_Relational_Datab
> >ases_Gener
> >for DBI->connect, but also using the code that I have -- got
> >"method not
> >supported"
> >
> >I"ll keep trying.  In the meantime, any ideas are appreciated, thanks!
> >
> >Christine
> >
> >Ronald J Kimball wrote:
> >>
> >> On Tue, Jun 19, 2001 at 07:09:40PM +0200, Christine Kluka wrote:
> >> > Now the error that I get is: "xxx.cgi did not produce a
> >valid header
> >> > (name without value:got line "variable $i" is not imported
> >at xxx.cgi
> >> > line 65.") I need to declare the subroutine "row" in which
> >the error is
> >> > found to do a "fetchrow" later in the script, and I can't
> >see an error
> >> > in the subroutine itself.  Help!
> >>
> >> You've got use strict, but you forgot to declare the variable $i:
> >>
> >> > sub row
> >> > {
> >> >
> >> >       $r = shift(@_);
> >> >       @r = @_;
> >> >       $nfields = $r->nfields;
> >> >       for ($i=0; $i<$nfields; $i++) {
> >> >               $fname = $r->fname($i);
> >> >               $r{$fname} = $r[$i];
> >> >       }
> >> >       return %r;
> >> > }
> >>
> >> Ronald
> >
> 
> __________________________________________________________________________
> Please Note :
> Only  the intended recipient is authorised to access or use this e-mail.  If
> you are not the intended recipient,
> please delete this e-mail and notify the sender immediately.   The contents
> of this e-mail are the writer's
> opinion and are not necessarily endorsed by the Gunz Companies unless
> expressly stated.
> 
> We use virus scanning software but exclude all liability for viruses or
> similar in any attachment.

Reply via email to