push @MANIFEST, 'lib/Config.pod', 'lib/Errno.pm', 'lib/lib.pm',
'lib/DynaLoader.pm', 'lib/XSLoader.pm';
+# If run in a clean source tree, these will be missing because they are
+# generated by the build.
+my %generated = (
+ 'encoding' => 'Allows you to write your script in non-ascii or non-utf8',
+ 'lib' => 'Manipulate @INC at compile time',
+ 'ops' => 'Restrict unsafe operations when compiling',
+ 'Config' => 'Access Perl configuration information',
+ 'DynaLoader' => 'Dynamically load C libraries into Perl code',
+ 'Errno' => 'System errno constants',
+ 'O' => 'Generic interface to Perl Compiler backends',
+ 'Safe' => 'Compile and execute code in restricted compartments',
+ 'XSLoader' => 'Dynamically load C libraries into Perl code',
+);
+
+# If run in a clean source tree, these should not be reported.
+# These are considered 'modules' by this script, but they really are not.
+my %suppressed = map {$_ => 1} qw(
+ B::O
+ Encode::encoding
+ Opcode::Safe
+ Opcode::ops
+);
+
for (@MANIFEST) {
- my $filename;
- next unless s|^lib/|| or m|^ext/|;
- my ($origfilename) = ($filename) = m|^(\S+)|;
- $filename =~ s|^[^/]+/|| if $filename =~ s|^ext/||;
- next unless $filename =~ m!\.p(m|od)$!;
- unless (open (MOD, "../lib/$filename")) {
- unless (open (MOD, "../$origfilename")) {
- warn "Couldn't open ../$origfilename: $!";
- next;
- }
- $filename = $origfilename;
- }
+ my $filename;
+ next unless s|^lib/|| or m|^ext/|;
+ my ($origfilename) = ($filename) = m|^(\S+)|;
+ $filename =~ s|^[^/]+/|| if $filename =~ s|^ext/||;
+ next unless $filename =~ m!\.p(m|od)$!;
+ unless (open (MOD, "../lib/$filename")) {
+ unless (open (MOD, "../$origfilename")) {
+ warn "Couldn't open ../$origfilename: $!";
+ next;
+ }
+ $filename = $origfilename;
+ }
my ($name, $thing);
my $foundit=0;
{
- local $/="";
- while (<MOD>) {
- next unless /^=head1 NAME/;
- $foundit++;
- last;
- }
+ local $/="";
+ while (<MOD>) {
+ next unless /^=head1 NAME/;
+ $foundit++;
+ last;
+ }
}
unless ($foundit) {
- warn "$filename missing =head1 NAME (okay if there is respective .pod)\n";
- next;
+ warn "$filename missing =head1 NAME (OK if respective .pod exists)\n";
+ next;
}
my $title = <MOD>;
chomp($title);
$perlname =~ s!\b(\w+)/\1\b!$1!;
$perlname =~ s!/!::!g;
+ # modules with non standard locations
+ $perlname =~ s{Base64::QuotedPrint}{QuotedPrint};
+
($name, $thing) = split / --? /, $title, 2;
unless ($name and $thing) {
- warn "$filename missing name\n" unless $name;
- warn "$filename missing thing\n" unless $thing;
- next;
+ warn "$filename missing name\n" unless $name;
+ warn "$filename missing thing\n" unless $thing;
+ next;
}
+ next if $suppressed{$perlname};
$thing =~ s/^perl pragma to //i;
$thing = ucfirst($thing);
} else {
push @pragma, $title;
}
+
+ # if we find a generated one via the MANIFEST, no need to add later.
+ delete $generated{$perlname};
+}
+while (my ($name,$desc) = each %generated) {
+ my $title = "=item $name\n\n$desc\n\n";
+ if ($name =~ /[A-Z]/) {
+ push @mod, $title;
+ } else {
+ push @pragma, $title;
+ }
}
print OUT <<'EOF';