Bio::DB::Universal: move into its own distribution
[bioperl-live.git] / maintenance / check_NAME.pl
blobbafb202e2efa0a7d6077dcb642b25cc16aaf1f16
1 #!/usr/bin/perl
3 =head1 NAME
5 check_NAMEs.pl - check NAME in module POD has fully qualified object name
7 =head1 SYNOPSIS
9 B<check_NAMEs.pl> [B<-d|--dir> path] [B<-v|--verbose>] [B<-?|-h|--help>]
11 =head1 DESCRIPTION
13 This script is designed to find all Bioperl modules which don't
14 have the fully qualified object name with correct capitalization
15 in the "NAME" section of the POD.
17 The full name is required for the PDOC POD to HTML script to
18 correctly render the module documentation.
20 =cut
22 use strict;
23 use File::Find;
24 use Getopt::Long;
27 # command line options
30 my ($verbose, $dir, $help) = (0, '../Bio/', undef);
31 GetOptions(
32 'v|verbose' => \$verbose,
33 'd|dir:s' => \$dir,
34 'h|help|?' => sub{ exec('perldoc',$0); exit(0) }
38 # globals
41 my $num_found = 0;
44 # find all modules
47 print STDERR "Searching for incorrect NAME POD section of all modules in: $dir\n";
48 find( \&find_modules, $dir );
49 print STDERR "$num_found found.\n";
51 # this is where the action is
53 sub find_modules {
54 # only want files with .pm
55 return unless m/\.pm$/;
56 return unless -f $_;
58 my $fname = $_;
59 my $pm = $File::Find::name;
60 $pm =~ s{.*?/(?=Bio/)}{}; # remove up to first slash before Bio/
61 $pm =~ s{\.pm$}{}; # remove .pm suffix
62 $pm =~ s{/}{::}g; # convert / to ::
64 print STDERR "# $File::Find::name\n" if $verbose;
66 # slurp in the file
67 my $text = do { local( @ARGV, $/ ) = $fname ; <> } ;
69 # check if the NAME section has the _full_ module name in it
70 if ($text !~ m/^=head1\s+NAME.*?^$pm/xms) {
71 print "$pm\n";
72 $num_found++;
77 =head1 OPTIONS
79 =over 3
81 =item B<-d | --dir> path
83 Overides the default directory to recursively look for .pm file
84 (Default is '../Bio')
86 =item B<-v | --verbose>
88 Show the progress through files during the POD checking.
90 =item B<-? | -h | --help>
92 This help text.
94 =back
96 =head1 FEEDBACK
98 =head2 Mailing Lists
100 User feedback is an integral part of the evolution of this and other
101 Bioperl modules. Send your comments and suggestions preferably to
102 the Bioperl mailing list. Your participation is much appreciated.
104 bioperl-l@bioperl.org - General discussion
105 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
107 =head2 Reporting Bugs
109 Report bugs to the Bioperl bug tracking system to help us keep track
110 of the bugs and their resolution. Bug reports can be submitted via the
111 web:
113 https://github.com/bioperl/bioperl-live/issues
115 =head1 AUTHOR - Torsten Seemann
117 Email: torsten-dot-seemann-at-infotech-dot-monash-dot-edu-dot-au
119 =cut