main script now has the version

This commit is contained in:
Dima Kogan 2013-02-08 01:43:19 -08:00
parent 24a56fd617
commit 28742230b6
2 changed files with 28 additions and 3 deletions

View File

@ -9,12 +9,28 @@ sub parseversion
# libpackage-perl (0.02)
#
# I parse out the 0.02 part
open DCH, 'Changes' or die "Couldn't open 'Changes'";
open DCH, '<', 'Changes' or die "Couldn't open 'Changes'";
my ($version) = <DCH> =~ /^\S+ \s* \( ([0-9\.]+) \)/x
or die "Couldn't parse version from 'Changes'";
close DCH;
# The version is also stored in the script itself. Here I extract that version
# number and make sure the two match
open PL, '<', 'bin/feedgnuplot' or die "Couldn't open 'bin/feedgnuplot'";
while(<PL>)
{
if( /VERSION = ([0-9\.]+)/ )
{
if ( $1 != $version )
{
die "Version mismatch. Changes says version is '$version', but 'bin/feedgnuplot' says it is '$1'";
}
return $version;
}
}
die "Couldn't parse version from 'bin/feedgnuplot'";
}
sub MY::libscan

View File

@ -12,6 +12,8 @@ use threads::shared;
use Thread::Queue;
use Pod::Usage;
my $VERSION = 1.24;
my %options;
interpretCommandline(\%options);
@ -108,7 +110,7 @@ sub interpretCommandline
'square!', 'square_xy!', 'hardcopy=s', 'maxcurves=i', 'monotonic!',
'histogram=s@', 'binwidth=f', 'histstyle=s',
'terminal=s',
'extraValuesPerPoint=i', 'help', 'dump',
'extraValuesPerPoint=i', 'help', 'dump', 'version',
'geometry=s') or pod2usage( -exitval => 1,
-verbose => 1, # synopsis and args
-output => \*STDERR );
@ -122,6 +124,12 @@ sub interpretCommandline
-output => \*STDOUT );
}
if( $options->{version} )
{
print "feedgnuplot version $VERSION\n";
exit 0;
}
# no global style if one isn't given
$options->{curvestyleall} = '' unless defined $options->{curvestyleall};
@ -1075,6 +1083,7 @@ As an example, if line 3 of the input is "0 9 1 20"
debugging.
--geometry If using X11, specifies the size, position of the plot window
--version Print the version and exit
=head1 ACKNOWLEDGEMENT