APM: Dumb program acting funny...

Barron Snyder (CE CEN) Barron.Snyder at wholefoods.com
Wed Oct 18 17:30:25 PDT 2006


From: austin-bounces+barron.snyder=wholefoods.com at pm.org
[mailto:austin-bounces+barron.snyder=wholefoods.com at pm.org] On Behalf Of
CaptNemo
Sent: Wednesday, October 18, 2006 5:56 PM
To: austin at pm.org
Subject: APM: Dumb program acting funny...

 

Okay, instead of just returning the first 3 records, I modified it to
print the whole line of records but now it acts up....
My database is 36 records wide and when I run it, I get:

[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.

...

 

Why am I getting 
        [Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized
value in concatenation (.) or string at ./dbquery.pl line 34.
                ... and then correct data!?!?!



----- 8<  SNIP  8< ----------------------

 

 

I'm fairly new to Perl but I've come across this myself. It's just a
warning. As I understand it, you're query is returning records that may
have NULL values in them that you're then adding these NULL values to an
array. The reason you're seeing the warnings interspersed with your
output is that everthing is being directed to the same place (the
program output/STDOUT and STDERR).

 

Someone please correct me if I'm way offbase on this.

 

-Barron

 

 

________________________________

From: austin-bounces+barron.snyder=wholefoods.com at pm.org
[mailto:austin-bounces+barron.snyder=wholefoods.com at pm.org] On Behalf Of
CaptNemo
Sent: Wednesday, October 18, 2006 5:56 PM
To: austin at pm.org
Subject: APM: Dumb program acting funny...

 

Okay, instead of just returning the first 3 records, I modified it to
print the whole line of records but now it acts up....
My database is 36 records wide and when I run it, I get:

[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in
concatenation (.) or string at ./dbquery.pl line 34.
VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,

Etc.

Why am I getting 
        [Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized
value in concatenation (.) or string at ./dbquery.pl line 34.
                ... and then correct data!?!?!



HERE's the Proggy
--------------------------------------------------
#!/usr/bin/perl -wT
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use DBI;
use strict;


my $dbdriver = $ARGV[0];
my $db = $ARGV[1];
my $dbuser = $ARGV[2];
my $dbpasswd = $ARGV[3];
my $dbtable = $ARGV[4];
my $condition = $ARGV[5];

my @row_array;
my $row;


if ( $#ARGV ==5 )
        {

                my $dbh = DBI->connect(
"DBI:$dbdriver:$db",$dbuser,$dbpasswd,)
                        || die "Database connection not made:
$DBI::errstr";
                
                
                my $sth = $dbh->prepare("SELECT * FROM $dbtable WHERE
$condition")
                        or die $dbh->errstr;
                $sth->execute() or die $dbh->errstr;
                
                while (@row_array = $sth->fetchrow_array)
                        {
                                foreach $row (@row_array)
                                {
                                        print "$row,";  # <------ THIS
IS LINE 34
                                }
                                print "\n";
                        }
                $dbh->disconnect();
        }
        elsif ( $#ARGV <= 4 ) {
                print
"\n-----------------------------ERROR------------------------------\n";
                print "NOT ENOUGH ARGUMENTS\n";
                print "dbquery.pl usage: dbquery.pl DBDRIVER DB DBUSER
DBPASSWORD DBTABLE \"CONDITION\"\n";
                print "NOTE: DBDIVER is usually \"mysql\" but it can be
other things like \"oracle\".\n";
                print "      EXAMPLE: dbquery.pl mysql databas...\n";
                print "NOTE: The total CONDITION must be in quotes with
the matching data in single quotes. \n";
                print "      EXAMPLE: \"product LIKE 'bicycle'\"\n";
                print "---------------------------END
ERROR----------------------------\n\n";
        }
                else {
                print
"\n-----------------------------ERROR------------------------------\n";
                print "TOO MANY ARGUMENTS\n";
                print "dbquery.pl usage: dbquery.pl DBDRIVER DB DBUSER
DBPASSWORD DBTABLE \"CONDITION\"\n";
                print "NOTE: DBDIVER is usually \"mysql\" but it can be
other things like \"oracle\".\n";
                print "      EXAMPLE: dbquery.pl mysql databas...\n";
                print "NOTE: The total CONDITION must be in quotes with
the matching data in single quotes. \n";
                print "      EXAMPLE: \"product LIKE 'bicycle'\"\n";
                print "---------------------------END
ERROR----------------------------\n\n";
        }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/austin/attachments/20061018/8d825ca8/attachment-0001.html 


More information about the Austin mailing list