Subject: | warnings in execution of DBD::google |
Using the example given in the POD, I get some warnings
Use of uninitialized value in integer gt (>) at /usr/lib/perl5/site_perl/5.6.1/Text/TabularDisplay.pm line 242.
Use of uninitialized value in integer gt (>) at /usr/lib/perl5/site_perl/5.6.1/Text/TabularDisplay.pm line 242.
Use of uninitialized value in integer gt (>) at /usr/lib/perl5/site_perl/5.6.1/Text/TabularDisplay.pm line 242.
Use of uninitialized value in string eq at /usr/lib/perl5/site_perl/5.6.1/Net/Google/Search.pm line 454.
and
(in cleanup) Driver has not implemented DESTROY for DBI::st=HASH(0x8159234) at perl/tttgoogle.pl line 0
(in cleanup) Driver has not implemented DESTROY for DBI::db=HASH(0x835de0c) at perl/tttgoogle.pl line 0
I am using Perl 5.6.1 with DBI 1.30 on a Linux box (kernel 2.4.18-6mdk)
Note: Creating an empty DESTROY sub in db.pm and st.pm, the second warnings disappear. I am not sure about the effectiveness of such action, though.
BTW, the module is just great!
#!/usr/bin/perl -w
use strict;
use DBI;
use Text::TabularDisplay;
my $query = "@ARGV" || "perl";
# Set up SQL statement -- note the multiple lines
my $sql = qq~
SELECT
title, URL, hostName
FROM
google
WHERE
q = "$query"
~;
# DBI/DBD options:
my %opts = ( RaiseError => 1, # Standard DBI options
PrintError => 0,
lr => [ 'en' ], # DBD::google options
oe => "utf-8",
ie => "utf-8",
);
# Get API key
my $keyfile = glob "~/.googlekey";
# Get database handle
my $dbh = DBI->connect("dbi:google:", $keyfile, undef, \%opts);
# Create Text::TabularDisplay instance, and set the columns
my $table = Text::TabularDisplay->new;
$table->columns("Title", "URL", "Hostname");
# Do the query
my $sth = $dbh->prepare($sql);
$sth->execute;
while (my @row = $sth->fetchrow_array) {
$table->add(@row);
}
$sth->finish;
print $table->render;