From: Nicholas Clark Date: Sat, 13 Jun 2009 20:43:30 +0000 (+0100) Subject: Bring the joy of strict (and warnings) to perlmodlib.PL. Tweak some indenting. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5b5041827ebfe6db62c72e5b64d221d66772b47a;p=p5sagit%2Fp5-mst-13.2.git Bring the joy of strict (and warnings) to perlmodlib.PL. Tweak some indenting. --- diff --git a/pod/perlmodlib.PL b/pod/perlmodlib.PL index 99fca65..a013d26 100644 --- a/pod/perlmodlib.PL +++ b/pod/perlmodlib.PL @@ -1,5 +1,8 @@ #!../miniperl +use strict; +use warnings; + $ENV{LC_ALL} = 'C'; use FindBin; @@ -34,46 +37,44 @@ for my $filename (@files) { next; } + my ($name, $thing); + my $foundit = 0; + { + local $/ = ""; + while () { + next unless /^=head1 NAME/; + $foundit++; + last; + } + } + unless ($foundit) { + warn "$filename missing =head1 NAME (OK if respective .pod exists)\n" + unless $Quiet; + next; + } + my $title = ; + chomp $title; + close MOD; - my ($name, $thing); - my $foundit=0; - { - local $/=""; - while () { - next unless /^=head1 NAME/; - $foundit++; - last; - } - } - unless ($foundit) { - warn "$filename missing =head1 NAME (OK if respective .pod exists)\n" - unless $Quiet; - next; - } - my $title = ; - chomp($title); - close MOD; - - ($name, $thing) = split / --? /, $title, 2; - - unless ($name and $thing) { - warn "$filename missing name\n" unless $name; - warn "$filename missing thing\n" unless $thing or $Quiet; - next; - } - - $name =~ s/[^A-Za-z0-9_:\$<>].*//; - $name = $exceptions{$name} || $name; - $thing =~ s/^perl pragma to //i; - $thing = ucfirst($thing); - $title = "=item $name\n\n$thing\n\n"; - - if ($name =~ /[A-Z]/) { - push @mod, $title; - } else { - push @pragma, $title; - } + ($name, $thing) = split / --? /, $title, 2; + unless ($name and $thing) { + warn "$filename missing name\n" unless $name; + warn "$filename missing thing\n" unless $thing or $Quiet; + next; + } + + $name =~ s/[^A-Za-z0-9_:\$<>].*//; + $name = $exceptions{$name} || $name; + $thing =~ s/^perl pragma to //i; + $thing = ucfirst $thing; + $title = "=item $name\n\n$thing\n\n"; + + if ($name =~ /[A-Z]/) { + push @mod, $title; + } else { + push @pragma, $title; + } } # Much easier to special case it like this than special case the depending on