my $data = GD::Graph::Data->new(); my $graph = GD::Graph::bars->new(); my $format = $graph->export_format; if ( $dbh = DBI->connect("DBI:ODBC:$INI{DSN}",$INI{DBuser},$INI{DBpass}) ) { my $gotdata = 0; my $stmt = 'SELECT SysID FROM MeterEvent WHERE Sysid >= 2 and Sysid < = 10'; if ( my $sth = $dbh->prepare($stmt) ) { if ( my $rows = $sth->execute ) { while (my @row = $sth->fetchrow_array) { $data->add_point(@row); $gotdata = 1; } } } $dbh->disconnect(); } else { print "Database Error$br\n"; } my $gd = $graph->plot($data); open(IMG, '>file.gif') or die $!; binmode IMG; print IMG $gd->gif; # this is the line # 80 if ( defined $gd ) { print " 4.gd defined\n"; } else {print " 4.gd NOT defined\n"; } close IMG;