fork download
  1. use CGI ':standard';
  2. use GD::Graph::bars;
  3. use strict;
  4.  
  5. # The data, monthly values
  6. my @data = (["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
  7. "Sep", "Oct", "Nov", "Dec"],
  8. [23, 5, 2, 20, 11, 33, 7, 31, 77, 18, 65, 52]);
  9. # Create the canvas, then set labels and title
  10. my $mygraph = GD::Graph::bars->new(500, 300);
  11. $mygraph->set(
  12. x_label => 'Month',
  13. y_label => 'Number of Hits',
  14. title => 'Number of Hits in Each Month in 2002',
  15. ) or warn $mygraph->error;
  16. # Plot the monthly data
  17. my $myimage = $mygraph->plot(\@data) or die $mygraph->error;
  18. # Output as PNG file
  19. open(IMG, ">output.png") or die $myimage->error;
  20. binmode IMG;
  21. print IMG $myimage->png;
  22.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
===SORRY!===
Unable to find module 'CGI' in the @*INC directories.
(@*INC contains:
  /home/CpqEaR/.perl6/lib
  /usr/lib/parrot/2.7.0/languages/perl6/lib
  .)
stdout
Standard output is empty