[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

perl gnuplot



Hello,
I want to run a script perl which use gnuplot.
this script gives statistics to a game named "loto", it consists
to choose seven numbers among 49 [1 .. 49]. (seven balls among 49 balls)
The script "loto2.pl", it works on the file of results named "loto15".
( in fact loto15 contains 3430 results not 15)
The script is launched by : cat loto15 | ./loto2.pl
The script loto2.pl runs almost fine as root but as user there is a 
problem of permission and the script doesn't work.
Can someone help me to solve this problem ?
I join the files that I used :
 loto2.pl
 loto15
and the errors :
loto_root.log
loto_user.log
T.I.A.  
-- 
Gerard
P.S.1 print PLOT qq{set term png color\n} (L42) don't works fine it
      change all the usual characters in strange characters.  

P.S.2 Without perl gnuplot works fine as user.
     No problem of permission, not error.
     However I don't think it is a problem with perl.

#!/usr/bin/perl -w

# loto2.pl

use strict;

use vars qw/@boule $i/;

for($i=1;$i<=49;$i++) {
$boule[$i]=0;
}

while(<>) {
my $line=$_;
my ($date,$tirage,$b1,$b2,$b3,$b4,$b5,$b6,$bc)=split(';',$line);
chomp($b1,$b2,$b3,$b4,$b5,$b6,$bc);
$boule[$b1]=$boule[$b1]+1;
$boule[$b2]=$boule[$b2]+1;
$boule[$b3]=$boule[$b3]+1;
$boule[$b4]=$boule[$b4]+1;
$boule[$b5]=$boule[$b5]+1;
$boule[$b6]=$boule[$b6]+1;

}
#			for($i=1;$i<=49;$i++){
# print "$boule[$i]:$i\n"
# print "$i $boule[$i]\n"
open(OUTPUT, ">/tmp/$$.loto")
or die "impossible to create the file tmp";
for($i=1;$i<=49;$i++){
print OUTPUT "$i $boule[$i]\n";
}
close(OUTPUT)
or die "impossible to close the file tmp";
open(PLOT, "| gnuplot")
or die "inpossible to launch gnuplot\n";
# print PLOT qq{set term png color\n}; 
print PLOT qq{set term linux\n};
print PLOT qq{set title "distribution of the balls"\n};
print PLOT qq{set xrange[-2:52]\n};
print PLOT qq{set xlabel "number of the balls"\n};
# print PLOT qq{set yrange[360:460]\n};
print PLOT qq{set yrange[0:10]\n};
print PLOT qq{set ylabel "number"\n};
print PLOT qq{plot "/tmp/$$.loto" with boxes 3\n};
close(PLOT)
or die "impossible to close the pipe -> gnuplot";
2001095;20011128;23;21;7;11;31;27;29;4;1432880.0;20;
2001095;20011128;36;25;31;29;32;37;17;2;6124665.0;4;
2001094;20011124;41;27;9;8;32;10;39;2;3851990.0;3;
2001094;20011124;24;16;27;1;37;25;13;0;0.0;9;
2001093;20011121;33;47;16;42;37;35;41;0;0.0;5;
2001093;20011121;35;4;5;49;3;2;46;2;2870735.0;1;
2001092;20011117;28;36;31;34;7;2;40;4;3461440.0;7;
2001092;20011117;4;6;10;39;31;21;23;2;3214700.0;6;
2001091;20011114;6;44;9;45;37;41;27;2;13137290.0;10;
2001091;20011114;5;45;34;31;28;37;3;0;0.0;5;
2001090;20011110;34;41;11;44;5;47;28;1;
2001090;20011110;1;27;18;26;16;14;24;1;
2001089;20011107;19;32;40;20;37;28;9;0;0.0;9;
2001089;20011107;31;24;22;46;35;37;29;4;
2001088;20011103;8;25;36;12;22;6;42;1;
line 0: Linux terminal driver not available
svgalib: S3: Unknown chip id 13e1
c20e2
int 0x10 is not in ram (0000:0000)
No VESA bios detected!
Try using vga_reset
Using VGA driver.
impossible to close the pipe -> gnuplot at ./loto2.pl line 45, <> chunk 3430.
         line 0: Linux terminal driver not available

svgalib: Cannot get I/O permissions.
inpossible to close the pipe -> gnuplot at ./loto2.pl line 45, <> chunk 3430.

Reply to: