Alien-Gnuplot
view release on metacpan or search on metacpan
lib/Alien/Gnuplot.pm view on Meta::CPAN
##############################
# Whew. Now parse out the 'GNUPLOT' and version number...
my $lines = join("", map { chomp $_; $_} @lines);
$lines =~ s/\s+G N U P L O T\s*// or die qq{
Alien::Gnuplot: the executable '$exec_path' appears not to be gnuplot,
or perhaps there was a problem running it. You can remove it or set
your GNUPLOT_BINARY variable to an actual gnuplot.
Raw output from Gnuplot:
$lines
};
$lines =~ m/Version (\d+\.\d+) (patchlevel (\d+))?/ or die qq{
Alien::Gnuplot: the executable file $exec_path claims to be gnuplot, but
I could not parse a version number from its output. Sorry, I give up.
Raw output from Gnuplot:
$lines
};
$version = $1;
$pl = $3;
$executable = $exec_path;
##############################
# Parse out available terminals and put them into the
# global list and hash.
@terms = ();
%terms = ();
my $reading_terms = 0;
for my $line(@lines) {
last if($line =~ m/CcColors/);
if(!$reading_terms) {
if($line =~ m/^Available terminal types\:/) {
$reading_terms = 1;
}
} else {
$line =~ s/^Press return for more\:\s*//;
$line =~ m/^\s*(\w+)\s(.*[^\s])\s*$/ || next;
push(@terms, $1);
$terms{$1} = $2;
}
}
##############################
# Parse out available colors and put them into that global list and hash.
@colors = ();
%colors = ();
for my $line(@lines) {
last if($line =~ m/FfFinished/);
next unless( $line =~ m/\s+([\w\-0-9]+)\s+(\#......)/);
$colors{$1} = $2;
}
@colors = sort keys %colors;
}
sub import {
my $pkg = shift;
$pkg->SUPER::import(@_);
$pkg->load_gnuplot();
};
1;
( run in 2.276 seconds using v1.01-cache-2.11-cpan-13bb782fe5a )