7 use Bio
::Root
::Version
;
14 # command line options
17 my ($verbose, $dir, $depfile, $help, $new, $outfile, $write, $version) =
18 (0, undef, "../DEPRECATED", undef, [], '../DEPRECATED.NEW', 0, $Bio::Root
::Version
::VERSION
);
20 'v|verbose' => \
$verbose,
21 'b|bp_version:s' => \
$version,
23 'depfile:s' => \
$depfile,
25 'o|outfile:s' => \
$outfile,
27 'h|help|?' => sub{ exec('perldoc',$0); exit(0) }
30 # Default directories to check
31 my @dirs = qw(../Bio/ );
33 # use version to consolidate old vs new versioning schemes
34 my $base_version = version
->new( $version );
36 print "Version: $base_version\n";
42 # parse DEPRECATED file
44 open my $DFILE, '<', $depfile || die "Can't open $depfile: $!";
46 while (my $data = <$DFILE>) {
47 if ($data =~ /^-+$/) {
51 next unless $seen_top;
53 my ($module, $dep, $rem, $note) = split(/\s+/,$data,4);
55 my $d = version
->new($dep);
56 my $r = version
->new($rem);
57 print "$module Dep: $d Rem: $r\n" if $verbose;
58 if ($rem <= $base_version) {
60 } elsif ($dep <= $base_version) {
61 $deprecated{$module}++;
63 push @dep_data, {module
=> $module,
72 my ($module, $dep, $rem, $note) = split(',',$new,4);
73 last if !$module || !$dep || !$rem;
74 if ($module !~ /Bio/) {
75 croak
"Can only deprecate BioPerl modules, not $module"
77 push @dep_data, {module
=> $module,
83 # run through all files in core (checks to see if anything is still present)
86 find
{wanted
=> \
&parse_core
, no_chdir
=> 1}, $dir;
88 find
{wanted
=> \
&parse_core
, no_chdir
=> 1}, @dirs;
97 if ($write || @
$new) {
99 open (my $NEWDEP, '>', $outfile) || croak
"Can't open $outfile :$!";
101 print $NEWDEP <<HEAD;
102 # These are modules which are deprecated and later removed from the toolkit
103 # See http://www.bioperl.org/wiki/Deprecated_modules for the latest details
107 # may replace with better formatting, but it needs to be round-tripped
110 "Deprecated Version Version ",
111 "Module Deprecated Removed Notes ",
112 "----------------------------------------------------------------------------------------------";
114 for my $datum (@dep_data) {
115 my ($mod, $dep, $rem, $note) = map {$datum->{$_}} qw
(module dep remove note
);
118 "{[[[[[[[[[[[[[[[[[[[[[[[[[[[[[} {|||||} {|||||} {[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[}",
119 $mod, $dep, $rem, $note;
131 # this is where the action is
136 return unless $file =~ /\.PLS$/ || $file =~ /\.p[ml]$/ ;
137 return unless -e
$file;
138 open my $F, $file || die "Could not open file $file";
139 while (my $line = <$F>) {
140 if ($line =~ /(?:['"])?\b(use|require)\s+([A-Za-z0-9:_\.\(\)]+)\s*([^;'"]+)?(?:['"])?\s*;/) {
141 my ($use, $mod) = ($1, $2);
142 if (exists $removed{$mod}) {
143 print "$File::Find::name: Line $.: $mod is removed\n";
144 } elsif (exists $deprecated{$mod}) {
145 print "$File::Find::name: Line $.: $mod is deprecated\n";
152 # $Id: deprecated.pl 10084 2006-07-04 22:23:29Z mauricio $
156 deprecated.pl - Check modules and scripts for use of deprecated modules and
157 methods, indicates presence in a file to STDERR. Optionally accepts new modules
158 and adds them to a newly formatted deprecation file.
162 B<deprecated.pl> [B<-d|--dir> path ] [B<-v|--verbose>] [B<-a|--depfile>]
163 [B<-n|--new>] [B<-w|--write>] [B<-o|--outfile>]
170 =item B<-d | --dir> path
172 Overides the default directories to check by one directory 'path' and
173 all its subdirectories.
175 =item B<-a | --depfile>
177 path from working directory that contains the DEPRECATED file.
181 New addition to the deprecation list; this should be in the form of
182 'Module,dep_release,remove_release,notes'. Notes should only be 40 chars long.
184 =item B<-b | --bp_version>
186 BioPerl version. This only appears to work correctly when using numerical
187 versions (1.5.2 instead of 1.005002)
189 =item B<-w | --write>
191 Write out new deprecation file to $outfile. If --new is used this is assumed.
193 =item B<-o | --outfile>
195 Name of output file to write deprecation table to. DEPRECATED.NEW is the default
198 =item B<-v | --verbose>
200 Show the progress through files during the checking.
202 =item B<-? | -h | --help>
212 User feedback is an integral part of the evolution of this and other
213 Bioperl modules. Send your comments and suggestions preferably to
214 the Bioperl mailing list. Your participation is much appreciated.
216 bioperl-l@bioperl.org - General discussion
217 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
219 =head2 Reporting Bugs
221 Report bugs to the Bioperl bug tracking system to help us keep track
222 of the bugs and their resolution. Bug reports can be submitted via the
225 https://redmine.open-bio.org/projects/bioperl/
227 =head1 AUTHOR - Chris Fields
229 Email cjfields-at-bioperl-dot-org