mirror of
https://github.com/dkogan/feedgnuplot.git
synced 2025-05-06 06:21:16 +08:00
Gnuplot-version-functionality into a subroutine. I now do this AFTER
parsing the commandline to allow the script to pass CPAN tests on machines without gnuplot installed
This commit is contained in:
parent
8f365d0521
commit
d9d99d3c34
@ -12,19 +12,11 @@ use Text::ParseWords;
|
|||||||
|
|
||||||
our $VERSION = '1.02';
|
our $VERSION = '1.02';
|
||||||
|
|
||||||
open(GNUPLOT_VERSION, 'gnuplot --version |') or die "Couldn't run gnuplot";
|
|
||||||
my ($gnuplotVersion) = <GNUPLOT_VERSION> =~ /gnuplot\s*(\d*\.\d*)/;
|
|
||||||
if(!$gnuplotVersion)
|
|
||||||
{
|
|
||||||
print STDERR "Couldn't find the version of gnuplot. Does it work? Trying anyway...\n";
|
|
||||||
$gnuplotVersion = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
close(GNUPLOT_VERSION);
|
|
||||||
|
|
||||||
my %options;
|
my %options;
|
||||||
interpretCommandline(\%options);
|
interpretCommandline(\%options);
|
||||||
|
|
||||||
|
my $gnuplotVersion = getGnuplotVersion();
|
||||||
|
|
||||||
# list containing the plot data. Each element is a reference to a list, representing the data for
|
# list containing the plot data. Each element is a reference to a list, representing the data for
|
||||||
# one curve. The first 'point' is a hash describing various curve parameters. The rest are all
|
# one curve. The first 'point' is a hash describing various curve parameters. The rest are all
|
||||||
# references to lists of (x,y) tuples
|
# references to lists of (x,y) tuples
|
||||||
@ -270,6 +262,20 @@ OEF
|
|||||||
return \%options;
|
return \%options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub getGnuplotVersion
|
||||||
|
{
|
||||||
|
open(GNUPLOT_VERSION, 'gnuplot --version |') or die "Couldn't run gnuplot";
|
||||||
|
my ($gnuplotVersion) = <GNUPLOT_VERSION> =~ /gnuplot\s*(\d*\.\d*)/;
|
||||||
|
if (!$gnuplotVersion)
|
||||||
|
{
|
||||||
|
print STDERR "Couldn't find the version of gnuplot. Does it work? Trying anyway...\n";
|
||||||
|
$gnuplotVersion = 0;
|
||||||
|
}
|
||||||
|
close(GNUPLOT_VERSION);
|
||||||
|
|
||||||
|
return $gnuplotVersion;
|
||||||
|
}
|
||||||
|
|
||||||
sub plotThread
|
sub plotThread
|
||||||
{
|
{
|
||||||
while(! $streamingFinished)
|
while(! $streamingFinished)
|
||||||
|
Loading…
Reference in New Issue
Block a user