lib/VOMS/updateversion.pl untested

filter: Statementstmt 0.0% 0 / 43 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 72 CC 4 SCAR 24.0
CC
4
Cov
0%
wanted
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 11.0
1 #!/usr/bin/perl
2  
3 # propagate version numbers
4  
5 use Cwd;
6 BEGIN {
7 unshift @INC, "./lib";
8 eval { require VOMS::Lite; };
9 }
10 use File::Find;
11 my $dir=getcwd;
12  
13 print "About to change Version to $VOMS::Lite::VERSION\n";
14  
15 find(\&wanted, "$dir/lib/VOMS/Lite");
16  
17 sub wanted {
18 if (/\.pm$/) {
19 print "$File::Find::name";
20 open (OLD,"<$File::Find::name") or die "couldn't open $File::Find::name for reading";
21 open (NEW,">$File::Find::name".".new") or die "couldn't open $File::Find::name for writing";
22 my $OK=0;
23 while (<OLD>) {
24 s/^\s*\$VERSION\s*=\s*'[^']*';\s*$/\$VERSION = '$VOMS::Lite::VERSION';\n/;
25 if ( m/VERSION = '$VOMS::Lite::VERSION'/ ) { $OK=1; }
26 print NEW $_;
27 }
28 close OLD;
29 close NEW;
30 print (($OK==1)?" [ OK ]\n":" [ FAIL ]\n");
31 rename "$File::Find::name".".new", "$File::Find::name";
32 }
33 }
34  
35 print "$dir/misc/perl-VOMS-Lite.spec";
36 open (OLD,"<$dir/misc/perl-VOMS-Lite.spec") or die "couldn't open perl-VOMS-Lite.spec for reading";
37 open (NEW,">$dir/misc/perl-VOMS-Lite.spec.new") or die "couldn't open perl-VOMS-Lite.spec.new for reading";
38  
39 my $OK=0;
40 while (<OLD>) {
41 s/^\s*Version:\s*\d[\d.]*\s*$/Version: $VOMS::Lite::VERSION\n/;
42 if ( m/Version: $VOMS::Lite::VERSION/ ) { $OK=1; }
43 print NEW $_;
44 }
45 close OLD;
46 close NEW;
47 print (($OK==1)?" [ OK ]\n":" [ FAIL ]\n");
48 rename "$dir/misc/perl-VOMS-Lite.spec.new", "$dir/misc/perl-VOMS-Lite.spec";
49  
50