From 28742230b65b886dd8488f7b23d21eb77b757184 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Fri, 8 Feb 2013 01:43:19 -0800 Subject: [PATCH] main script now has the version --- Makefile.PL | 20 ++++++++++++++++++-- bin/feedgnuplot | 11 ++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index b14e8c8..3b28356 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -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) = =~ /^\S+ \s* \( ([0-9\.]+) \)/x or die "Couldn't parse version from 'Changes'"; 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() + { + 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 diff --git a/bin/feedgnuplot b/bin/feedgnuplot index 224d412..4d2196a 100755 --- a/bin/feedgnuplot +++ b/bin/feedgnuplot @@ -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