Bonjour à Tous,

Je souhaite utiliser le module DBD::Chart::Plot pour réaliser des graphiques mais malheureusement, il me crée des fichiers vides. J'utilise MS Windows Vista, Perl 5.8.8 et Apache 2.2.4

Voici, ci-dessous, le code Perl, le message affiché dans le navigateur web et les messages d'erreurs du fichier error.log du dossier logs d'Apache:

1. Code Perl

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!C:\Perl\bin\perl.exe -w
use strict;
 
use CGI;
my $cgi = new CGI;
use CGI::Carp qw(fatalsToBrowser);
 
use GD;
use GD::Graph;
 
use DBD::Chart;
use DBD::Chart::Plot;
 
my @xdata = qw( -3  -2  -1  0  1  2  3 );
my @ydata = qw(  9   4   1  12  1  4  9 );
 
#Create an image object: new()
my $img = DBD::Chart::Plot->new();
my $anotherImg = DBD::Chart::Plot->new();
 
#Graph-wide options: setOptions()    
$img->setOptions (
        title => 'My Graph Title',
        xAxisLabel => 'my X label',
        yAxisLabel => 'my Y label' );
 
#Establish data points: setPoints()    
$img->setPoints(\@xdata, \@ydata);
 
#Draw the image: plot()   
open (WR,'>plot.png') or die ("Failed to write file: $!");
binmode WR;            # for DOSish platforms
print WR $img->plot();
close WR;
 
print "Content-type: image/png\n\n";
print "\r\n";         # for DOSish platforms
binmode (STDOUT);
print  $img->plot();
2. Message du navigateur web:

L'image “http://localhost/cgi-bin/essaitemplategd.pl” ne peut être affichée car elle contient des erreurs.
3. Message d'erreurs du fichier error.log d'Apache
[Sat May 10 10:15:23 2008] [error] [client 127.0.0.1] [Sat May 10 10:15:23 2008] essaitemplategd.pl: Use of uninitialized value in numeric eq (==) at C:/Perl/site/lib/DBD/Chart/Plot.pm line 1538., referer: http://localhost/simulation_fichiers/menusimulation.htm
[Sat May 10 10:15:23 2008] [error] [client 127.0.0.1] [Sat May 10 10:15:23 2008] essaitemplategd.pl: Use of uninitialized value in numeric eq (==) at C:/Perl/site/lib/DBD/Chart/Plot.pm line 1538., referer: http://localhost/simulation_fichiers/menusimulation.htm
[Sat May 10 10:15:23 2008] [error] [client 127.0.0.1] [Sat May 10 10:15:23 2008] essaitemplategd.pl: Use of uninitialized value in numeric eq (==) at C:/Perl/site/lib/DBD/Chart/Plot.pm line 1548., referer: http://localhost/simulation_fichiers/menusimulation.htm
[Sat May 10 10:15:23 2008] [error] [client 127.0.0.1] [Sat May 10 10:15:23 2008] essaitemplategd.pl: Use of uninitialized value in numeric eq (==) at C:/Perl/site/lib/DBD/Chart/Plot.pm line 1562., referer: http://localhost/simulation_fichiers/menusimulation.htm
[Sat May 10 10:15:23 2008] [error] [client 127.0.0.1] [Sat May 10 10:15:23 2008] essaitemplategd.pl: Use of uninitialized value in numeric eq (==) at C:/Perl/site/lib/DBD/Chart/Plot.pm line 1562., referer: http://localhost/simulation_fichiers/menusimulation.htm
[Sat May 10 10:15:23 2008] [error] [client 127.0.0.1] [Sat May 10 10:15:23 2008] essaitemplategd.pl: Use of uninitialized value in print at C:/WWW/Apache/cgi-bin/essaitemplategd.pl line 33., referer: http://localhost/simulation_fichiers/menusimulation.htm
Le fichier plot.png est effectivement créé mais il ne contient aucune image. Par ailleurs, j'ai obtenu le même résultat lorsque je charge les données à partir de fichiers externes. Je souhaiterais bénéficier de votre aide pour résoudre ce problème. Merci d'avance.