trick/bin/pm/trick_version.pm
Alex Lin 14a75508a3 Cleaning up once include variables and copyright cleanup.
Changed all header file once include variables to follow the same naming
convention and not start with any underscores.  Also deleted old
incorrect copyright notices.  Also removed $Id: tags from all files.

Fixes #14.  Fixes #22.
2015-03-23 16:03:14 -05:00

33 lines
881 B
Perl

package trick_version ;
use Exporter ();
@ISA = qw(Exporter);
@EXPORT = qw(get_trick_version);
use strict;
sub get_trick_version() {
my ($current_version , $thread_version , $service_issues ) ;
my (@all_lines , $file_contents) ;
if ( !exists $ENV{"TRICK_HOME"} ) {
die "TRICK_HOME is not set\n" ;
}
open FILE, "$ENV{\"TRICK_HOME\"}/bin/trick_ver.txt" or
die "trick_version: Couldn't find $ENV{\"TRICK_HOME\"}/bin/trick_ver.txt\n" ;
@all_lines = <FILE> ;
close FILE ;
$file_contents = join "" , @all_lines ;
($current_version) = $file_contents =~ /current_version\s*=\s*"([^"]+)"/ ;
($thread_version) = $file_contents =~ /thread_version\s*=\s*"([^"]+)"/ ;
($service_issues) = $file_contents =~ /service_issues\s*=\s*"(.+)"/s ;
return ( $current_version , $thread_version , $service_issues ) ;
}
1 ;