my $dbps = DBI->connect($dsn, 'root', 'password');
my $pgprep = $dbps->prepare('SELECT * FROM polls');
$pgprep->execute();
while (my $ref = $pgprep->fetchrow_hashref()) {
my @labels = split(/#NEXT#/, $ref->{'choice'});
my @values = split(/#/, $ref->{'votes'});
my @data = (\@labels, \@values);
open (TST, ">testtt.txt");
print TST $#values;
print TST "\n".$#labels;
close (TST);
my $graph = new GD::Graph::bars3d(300,300);
$graph->set(
x_label => 'Poll Choices',
y_label => 'Votes',
title => $ref->{'title'},
dclrs => [ qw(orange blue green) ],
borderclrs => [ qw(orange) ],
x_labels_vertical => 1,
labelclr => $param{'labelClr'},
axislabelclr => $param{'axisClr'},
textclr => $param{'titleClr'},
cycle_clrs => 1
);
$graph->set_title_font($param{'fontPath'}.$param{'titleFont'}.'.ttf', $param{'titleSize'});
$graph->set_x_label_font($param{'fontPath'}.$param{'xLabelFont'}.'.ttf', $param{'xLabelSize'});
$graph->set_x_axis_font($param{'fontPath'}.$param{'xAxisFont'}.'.ttf', $param{'xAxisSize'});
$graph->set_y_label_font($param{'fontPath'}.$param{'yLabelFont'}.'.ttf', $param{'yLabelSize'});
$graph->set_y_axis_font($param{'fontPath'}.$param{'yAxisFont'}.'.ttf', $param{'yAxisSize'});
open (PNG, '>'.$param{'apacheRoot'}.$param{'graphImg'}.$ref->{'id'}.'.png');
binmode PNG;
print PNG $graph->plot(\@data)->png; #THis is where the eval error is.
close (PNG);
print '
';
print '
| '.$ref->{'title'}.' |
';
print ' ';
print ' |