trick/bin/pm/trick_version.pm
2015-02-26 09:02:31 -06:00

35 lines
936 B
Perl

package trick_version ;
# $Id: trick_version.pm 49 2009-02-02 22:37:59Z lin $
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 ;