Remove use of Bio::Perl which has been moved to Bio-Procedural.
[bioperl-live.git] / maintenance / version.pl
blobedec2376c234dfa2faece6124846ee5fc4f1f7a8
1 #!/usr/bin/perl
3 =head1 version
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.]
9 =head1 USAGE
11 perl version.pl <module directory> <version>
13 =cut
15 use strict;
17 if(@ARGV < 2) {
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';
23 sub traveral_dir {
24 my ($dir, )=@_;
25 opendir DIR, $dir;
26 my @allfiles= grep{$_ ne '.' and $_ ne '..'}readdir DIR;
27 closedir 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($_);
33 return @out;
36 my @pm=sort grep /\.pm$/, traveral_dir($dir);
38 use ExtUtils::MakeMaker;
40 map {
41 my $f=$_;
42 my $v = MM->parse_version($f);
43 print "$v\t$f\n";
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`;
51 } @pm;