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) # libpackage-perl (0.02)
# #
# I parse out the 0.02 part # 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 my ($version) = <DCH> =~ /^\S+ \s* \( ([0-9\.]+) \)/x
or die "Couldn't parse version from 'Changes'"; or die "Couldn't parse version from 'Changes'";
close DCH; close DCH;
return $version; # 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 sub MY::libscan

View File

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