5 This script is to add or modify version declaration for each bioperl pm.
7 [Currently, it just add version. Later I will update it to modify version.]
11 perl version.pl <module directory> <version>
18 die "USAGE: perl version.pl <module directory> <version>\n";
20 my $dir=shift || "$ENV{HOME}/src/bioperl-live/";
21 my $version=shift || '1.4';
26 my @allfiles= grep{$_ ne '.' and $_ ne '..'}readdir DIR
;
28 my @full_path = map{"$dir/$_"} @allfiles;
29 my @out = grep -f
, @full_path;
30 foreach(grep -d
, @full_path){
31 push @out, traveral_dir
($_);
36 my @pm=sort grep /\.pm$/, traveral_dir
($dir);
38 use ExtUtils
::MakeMaker
;
42 my $v = MM
->parse_version($f);
44 my $ep ='s/^(package\s+[\w:]+;\r?)$/$1\nour \$VERSION="'. $version.'";/';
46 if((not defined $v) or $v eq 'undef'){ # This is strange on parse_version.
47 # It return scalar 'undef', not the undef can be detected by defined.
48 `perl -p -i -e '$ep' $f`;