=back
If the C<PERL_POD_PEDANTIC> environment variable is set or the C<--pedantic>
-command line argument is provided then a few more checks are made.
+command line argument is provided, then a few more checks are made.
The pedantic checks are:
=over
canonicalize('cpan/Pod-Perldoc/corpus/perlfunc.pod') => 1,
canonicalize('cpan/Pod-Perldoc/corpus/utf8.pod') => 1,
canonicalize("lib/unicore/mktables") => 1,
- canonicalize("core") => 1,
);
# This list should not include anything for which case sensitivity is
| $dl_ext # dynamic libraries
| gif # GIF images (example files from CGI.pm)
| eg # examples from libnet
- | core
+ | core .*
)
$
) | ~$ | \ \(Autosaved\)\.txt$ # Other editor droppings
| ^cxx\$demangler_db\.$ # VMS name mangler database
| ^typemap\.?$ # typemap files
| ^(?i:Makefile\.PL)$
+ | ^core (?: $ | \. .* )
/x;
# Matches something that looks like a file name, but is enclosed in C<...>
# '.PL' files should be excluded, as they aren't final pods, but often contain
# material used in generating pods, and so can look like a pod. We can't use
-# the regexp above because case sensisitivity is important for these, as some
+# the regexp above because case sensitivity is important for these, as some
# '.pl' files should be examined for pods. Instead look through the MANIFEST
# for .PL files and get their full path names, so we can exclude each such
# file explicitly. This works because other porting tests prohibit having two
my %linkable_item; # Bool: if the latest =item is linkable. It isn't
# for bullet and number lists
my %linkable_nodes; # Pod::Checker adds all =items to its node list,
- # but not all =items are linkable to
+ # but not all =items are linkable-to
my %running_CFL_text; # The current text that is being accumulated until
# an end_FOO is found, and this includes any C<>,
# F<>, or L<> directives.
}
}
-package Tie_Array_to_FH { # So printing actually goes to an array
-
- my %array;
-
- sub TIEHANDLE {
- my $class = shift;
- my $array_ref = shift;
-
- my $self = bless \do{ my $anonymous_scalar }, $class;
- $array{Scalar::Util::refaddr $self} = $array_ref;
-
- return $self;
- }
-
- sub PRINT {
- my $self = shift;
- push @{$array{Scalar::Util::refaddr $self}}, @_;
- return 1;
- }
-}
-
-
my %filename_to_checker; # Map a filename to its pod checker object
my %id_to_checker; # Map a checksum to its pod checker object
my %nodes; # key is filename, values are nodes in that file.
note("-----\n" . Text::Tabs::expand("$total\tknown potential issues"));
if (%suppressed_files) {
note("\nFiles that have all messages of at least one type suppressed:");
- note(join ",", keys %suppressed_files);
+ note(join ",", sort keys %suppressed_files);
}
exit 0;
}
sub extract_pod { # Extracts just the pod from a file; returns undef if file
# doesn't exist
my $filename = shift;
- use Pod::Parser;
- my @pod;
-
- # Arrange for the output of Pod::Parser to be collected in an array we can
- # look at instead of being printed
- tie *ALREADY_FH, 'Tie_Array_to_FH', \@pod;
if (open my $in_fh, '<:bytes', $filename) {
- my $parser = Pod::Parser->new();
- $parser->parse_from_filehandle($in_fh, *ALREADY_FH);
+ use Pod::Simple::JustPod;
+ my $parser = Pod::Simple::JustPod->new();
+ $parser->no_errata_section(1);
+ $parser->no_whining(1);
+ $parser->source_filename($filename);
+ my $output;
+ $parser->output_string( \$output );
+ $parser->parse_lines( <$in_fh>, undef );
close $in_fh;
- return join "", @pod
+ return $output;
}
# The file should already have been opened once to get here, so if that
if ($filename =~ / (?: ^(cpan|lib|ext|dist)\/ )
| $only_for_interior_links_re
- /x) {
+ /x)
+ {
$digest->add($contents);
$digests{$filename} = $digest->digest;
next FILE;
}
$parsed = 1;
-
}
if ($checker->num_errors() < 0) { # Returns negative if not a pod
my $problem_count = scalar @{$problems{$filename}{$message}};
$total_known += $problem_count;
next if $known_problems{$canonical}{$message} < 0;
+
+ # If we have new problems not previously known, we output all of
+ # such problems, as we can't know which are really new and which
+ # not
if ($problem_count > $known_problems{$canonical}{$message}) {
# Here we are about to output all the messages for this type,
&& ! ok (keys %known_problems == 0, "The known problems database ($data_dir/known_pod_issues.dat) includes no references to non-existent files"))
{
note("The following files were not found: "
- . join ", ", keys %known_problems);
+ . join ", ", sort keys %known_problems);
note("They will automatically be removed from the db the next time");
note(" cd t; ./perl -I../lib porting/podcheck.t --regen");
note("is run");