From: David Mitchell Date: Sat, 16 May 2009 23:31:43 +0000 (+0100) Subject: add reload_manifest() function to Porting/maintainers.pm X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=da92fd6071387be2a444dac8cdba07b4488e05e0;p=p5sagit%2Fp5-mst-13.2.git add reload_manifest() function to Porting/maintainers.pm to allow the MANIFEST file to be read more than once. Also be more liberal in parsing the MANIFEST file (it now handles lines with no second column), and warn on bad lines . --- diff --git a/Porting/Maintainers.pm b/Porting/Maintainers.pm index 666e451..7929352 100644 --- a/Porting/Maintainers.pm +++ b/Porting/Maintainers.pm @@ -18,25 +18,38 @@ use vars qw(@ISA @EXPORT_OK $VERSION); @ISA = qw(Exporter); @EXPORT_OK = qw(%Modules %Maintainers get_module_files get_module_pat - show_results process_options files_to_modules); -$VERSION = 0.02; + show_results process_options files_to_modules + reload_manifest); +$VERSION = 0.03; require Exporter; use File::Find; use Getopt::Long; my %MANIFEST; -if (open(MANIFEST, "MANIFEST")) { - while () { - if (/^(\S+)\t+(.+)$/) { - $MANIFEST{$1}++; + +# (re)read the MANIFEST file, blowing away any previous effort + +sub reload_manifest { + %MANIFEST = (); + if (open(MANIFEST, "MANIFEST")) { + while () { + if (/^(\S+)/) { + $MANIFEST{$1}++; + } + else { + warn "MANIFEST:$.: malformed line: $_\n"; + } } + close MANIFEST; + } else { + die "$0: Failed to open MANIFEST for reading: $!\n"; } - close MANIFEST; -} else { - die "$0: Failed to open MANIFEST for reading: $!\n"; } +reload_manifest; + + sub get_module_pat { my $m = shift; split ' ', $Modules{$m}{FILES};