#!/usr/bin/perl -w # $Id: authors.pl 10084 2006-07-04 22:23:29Z mauricio $ # =head1 NAME authors.pl - check modules and scripts for authors not in AUTHORS file =head1 SYNOPSIS B [B<-d|--dir> path ] [B<-v|--verbose>] B<-a|--authorsfile> [B<-?|-h|--help>] =head1 DESCRIPTION Checks Plain Old Documentation (POD) of all bioperl live modules for AUTHORS and CONTRIBUTORS tags and prints out any emails missing from the AUTHORS file =cut use Data::Dumper; use File::Find; use Getopt::Long; use strict; sub findauthors; # # command line options # my ($verbose, $dir, $authorsfile, $help) = (0, undef, "../AUTHORS", undef); GetOptions( 'v|verbose' => \$verbose, 'dir:s' => \$dir, 'authorsfile:s' => \$authorsfile, 'h|help|?' => sub{ exec('perldoc',$0); exit(0) } ); # # global variables # # known authors from the AUTHORS file are read into # the hash which is initialized with known synonymes our %AUTHORS = map {$_=>1} qw{ birney@sanger.ac.uk jinsana@gmx.net Insana@ebi.ac.uk fugui@worf.fugu-sg.org cjm@fruitfly.bdgp.berkeley.edu elia@tll.org.sg heikki-at-bioperl-dot-org bioinformatics@dieselwurks.com bioinformatics1@dieselwurks.com bioperl-l@bio.perl.org paul@systemsbiology.org gattiker@isb-sib.ch elia@fugu-sg.org jason@cgt.mc.duke.edu jason@chg.mc.duke.edu jason@open-bio.org hilmar.lapp@pharma.novartis.com richard.adams@ed.ac.uk dblock@gene.pbi.nrc.ca ak@ebi.ac.uk day@cshl.org bala@tll.org.sg mrp@sanger.ac.uk m.w.e.j.fiers@plant.wag-ur.nl cmzmasek@yahoo.com fuguteam@fugu-sg.org shawnh@gmx.net }; our %NEWAUTHORS; # new authors our %FIND_OPTIONS = ( wanted => \&findauthors, no_chdir => 1 ); # Directories to check my @dirs = qw( ../Bio/ ../scripts . ); #print Dumper \%AUTHORS; # # Read the AUTHORS file # open (F, $authorsfile) || die "can't open file $authorsfile: $!"; while () { my ($email) = /([\.\w_-]+ at [\.\w_-]+)/; next unless $email; #print $email, "\n"; $email =~ s/ at /@/; $AUTHORS{$email} = 1; } close F; # # run # if ($dir) { find \%FIND_OPTIONS, $dir; } else { find \%FIND_OPTIONS, @dirs; } # # results # print Dumper \%NEWAUTHORS; # ## ### end main ## # # # this is where the action is # sub findauthors { return unless /\.PLS$/ or /\.p[ml]$/ ; return unless -e $_; print "$_\n" if $verbose; my $filename = $_; #local $/=undef; open F, $_ || die "Could not open file $_"; while () { #print; last if /=head1 +AUTHOR/; } my $authorblock; while () { last if /=head/ and not /CONTRIBUTORS/; $authorblock .= $_; } return unless $authorblock; while ( $authorblock =~ /([\.\w_-]+@[\.a-z_-]+)/g) { #my $email = $1; #$email =~ // next if $AUTHORS{$1}; #print "$filename\t$1\n"; push @{$NEWAUTHORS{$1}}, $filename; } } =head1 OPTIONS =over 3 =item B<-d | --dir> path Overides the default directories to check by one directory 'path' and all its subdirectories. =item B<-a | --authorsfile> path from working directory the AUTHORS file. Redundant as this information could be had from --dir option butI am feeling too lazy to change the code. =cut sub blankline { return unless /\.PLS$/ or /\.p[ml]$/ ; return unless -e $_; my $file = $_; open (F, $_) or warn "can't open file $_: $!" && return; local $/=""; while () { print "$file: +|$1|\n" if /[ \t]\n(=[a-z][^\n]+$)/m and $verbose; print "$file: ++|$1|\n" if /\w\n(=[a-z][^\n]+$)/m and $verbose; print "$file:|$1|+\n" if /(^=[a-z][^\n]+)\n[\t ]/m; #print "$file:|$1|++\n" if /(^=[^\n]+)\n\w/m; } close F; } __END__ =item B<-v | --verbose> Show the progress through files during the POD checking. =item B<-? | -h | --help> This help text. =back =head1 FEEDBACK =head2 Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists =head2 Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web: http://bugzilla.open-bio.org/ =head1 AUTHOR - Heikki Lehvaslaiho Email heikki-at-bioperl-dot-org =cut # find . -name '*.pm' -print | xargs perl -e '$/=""; while (<>) {$n = $1 if /^package\s+([\w:]+)/; print "$n:|$1|" if /(\s\s^=[^\n]+$)/m ; }' ; # find . -name '*.pm' -print | xargs perl -e '$/=""; while (<>) {$n = $1 if /^package\s+([\w:]+)/; print "$n:|$1|\n" if /(^=[^\n]+\n[\t ])/m ; }' ;