Howdy Y'all,
I'm trying to create a graphical plot image on the fly to be incorporated in a webpage Perl program. The Perl program creates Apache statistics using a CGI object. My question is how do I output the graph image inbetween calls to the CGI object? I can't seem to find documentation that details doing this. This is the page I'm outputting:
sub cgiOut {
print $q->header( "text/html" ),
$q->start_html( -title=>"Apache Stats for $hostname",
-bgcolor=>"#383838",
-text=>"#FFFFFF",
-link=>"#FFFFFF",
-alink=>"#FFFFFF",
-vlink=>"#FFFFFF"),
$q->h2( "Apache Stats for $hostname" ),
$q->start_form( -method=>"POST",
-action=>"/cgi-bin/logrep"),
$q->popup_menu( -name=>'filename',
, -values=>[ '/var/log/apache/access_log',
'/var/log/apache/access_log.1',
'/var/log/apache/access_log.2',
'/var/log/apache/access_log.3',
'/var/log/apache/access_log.4',
'/var/log/apache/access_log.5',
'/var/log/apache/access_log.6',
'/var/log/apache/access_log.7',
'/var/log/apache/mega',],
-defaults=>'',
-labels=>"Label");
print " ";
print $q->submit( -value=>"Query" );
print " ";
print $q->reset,
$q->end_form,
$q->a( { href=>$q->url() }, "Refresh" );
print " ";
print $q->a( { href=>"/lug" }, "Home" ),
$q->hr,
$q->br;
&tableOut(1, $q, 'Host Client', 'Hits', %host);
print $q->br;
my @data = (
["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
[ 1203, 3500, 3973, 2859, 3012, 3423, 1230]
);
my $graph = new GD::Graph::lines3d( 400, 300 );
$graph->set(
x_label => 'Day of the week',
y_label => 'Number of hits',
title => 'Daily Summary of Web Site',
);
my $gd = $graph->plot( \@data );
# ---> HOW DO I PRINT THIS $gd object, create another CGI object p
+erhaps??
&tableOut(0, $q, 'Referring Site', 'Ref\'d', %ref);
print $q->br;
&tableOut(0, $q, , 'Page Requested', 'Hits', %page);
print $q->br,
$q->hr;
print $q->p( "Created by <a href=\"mailto:pararox\@host61.g
+rad.iit.edu\">Pararox</a>" );
print $q->end_html;
1;
}
That graph is just a temp, ripped directly from the GD::Grap3d documentation. How would I go about printing that to the webpage after the initial &tableOut()?
Thanks, hope the weekend has been restful to ya!,
Lacertus
------------------------------------
"There is more in heaven and earth
than is dreamt of in your philosophy"