1+ # !/usr/bin/perl
2+ use strict;
3+ use warnings;
4+
15# my $ourLAST = 1; # T: change my $LAST_UPDATE to our $LAST_UPDATE
26
37 my $src = $ARGV [0]; # directory root to work in for this call
@@ -18,14 +22,15 @@ sub update_version {
1822
1923 my @types = (' pl' , ' pm' ); # places to look for pattern in
2024 my @read_only = (0, 0); # places to expect to be R/O
25+ my ($SRC , $IN , $OUT );
2126
2227 # open this directory for reading
23- opendir (SRC, " $src " ) || die " unable to open dir '$src ': $! " ;
28+ opendir ($ SRC , " $src " ) || die " unable to open dir '$src ': $! " ;
2429
2530 my @dirList = ();
2631 my @fileList = ();
2732
28- while ($entry = readdir (SRC)) {
33+ while ($entry = readdir ($ SRC )) {
2934 if ($entry eq ' .' || $entry eq ' ..' ) { next ; }
3035
3136 if (-d " $src \\ $entry " ) {
@@ -42,10 +47,10 @@ sub update_version {
4247
4348 # done reading, so close directory
4449 # have list of files and subdirectories within this one
45- closedir (SRC);
50+ closedir ($ SRC );
4651
4752 while ($name = shift (@fileList )) {
48- if ($name =~ m / - Copy/ ) { next ; }
53+ if ($name =~ m / - Copy/ ) { next ; }
4954 # $name is full file path and name
5055 $ro_flag = 0;
5156 for (my $i =0; $i <scalar @types ; $i ++) {
@@ -55,24 +60,24 @@ sub update_version {
5560 # make Read-Write
5661 if ($ro_flag ) { system (" attrib -R $name " ); }
5762
58- unless (open (IN, " <$name " )) {
63+ unless (open ($ IN , " <" , $name )) {
5964 die " Unable to update $name with version\n " ;
6065 }
61- unless (open (OUT, " >$outtemp " )) {
66+ unless (open ($ OUT , " >" , $outtemp )) {
6267 die " Unable to open temporary output file $outtemp \n " ;
6368 }
6469
65- while ($line = <IN>) {
70+ while ($line = <$ IN >) {
6671 # $line still has line-end \n
6772 $line =~ s / $pattern/ $newVer / ;
6873 # if ($ourLAST) {
6974 # $line =~ s/^my \$LAST_UPDATE/our \$LAST_UPDATE/;
7075 # }
71- print OUT $line ;
76+ print $ OUT $line ;
7277 }
7378
74- close (IN);
75- close (OUT);
79+ close ($ IN );
80+ close ($ OUT );
7681 $outtemp =~ s # /# \\ # g ;
7782 $name =~ s # /# \\ # g ;
7883 system (" copy $outtemp $name " );
@@ -87,4 +92,5 @@ sub update_version {
8792 update_version($entry );
8893 }
8994
95+ return ;
9096}
0 commit comments