print "1..0 # $^O cannot handle this test\n";
exit(0);
}
+ if ( $ENV{'PERL_BUILD_PACKAGING'} ) {
+ print "1..0 # This distro may have modified some files in cpan/. Skipping validation. \n";
+ exit 0;
+ }
require '../regen/regen_lib.pl';
}
A pod can't be linked to unless it has a unique name.
And a NAME should have a dash and short description after it.
+=item Occurrences of the Unicode replacement character
+
+L<Pod::Simple> replaces bytes that aren't valid according to the document's
+encoding (declared or auto-detected) with C<\N{REPLACEMENT CHARACTER}>.
+
+=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.
The pedantic checks are:
valid in the database
actually are. Thus any errors introduced there will remain there.
-=back
-
=head2 Specially handled pods
=over
my $duplicate_name = "Pod NAME already used";
my $no_name = "There is no NAME";
my $missing_name_description = "The NAME should have a dash and short description after it";
+my $replacement_character = "Unicode replacement character found";
# the pedantic warnings messages
my $line_length = "Verbatim line length including indents exceeds $MAX_LINE_LENGTH by";
my $C_not_linked = "? Should you be using L<...> instead of";
| $dl_ext # dynamic libraries
| gif # GIF images (example files from CGI.pm)
| eg # examples from libnet
+ | 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<...>
# exclude various things that have slashes
# in them but aren't paths
(?!
- (?: (?: s | qr | m) / ) # regexes
+ (?: (?: s | qr | m | tr | y ) / ) # regexes
| \d+/\d+ \b # probable fractions
| (?: [LF] < )+
| OS/2 \b
last SKIP;
}
- sub note {
- my $message = shift;
+ sub _note {
+ my ($andle, $message) = @_;
chomp $message;
- print $message =~ s/^/# /mgr;
- print "\n";
+ print $andle $message =~ s/^/# /mgr;
+ print $andle "\n";
return;
}
+ sub note { unshift @_, \*STDOUT; goto &_note }
+
+ sub diag { unshift @_, \*STDERR; goto &_note }
+
END {
if ($planned && $planned != $current_test) {
print STDERR
$running_CFL_text{$addr} .= $text;
}
+ # do this line-by-line so we can get the right line number
+ my @lines = split /^/, $running_simple_text{$addr};
+ for my $i (0..$#lines) {
+ if ($lines[$i] =~ m/\N{REPLACEMENT CHARACTER}/) {
+ $self->poderror({ -line => $start_line{$addr} + $i,
+ -msg => $replacement_character,
+ parameter => "possibly invalid ". $self->encoding . " input at character " . pos $lines[$i],
+ });
+ }
+ }
return $return;
}
$diagnostic .= " " if $problem_count == 1;
$diagnostic .= "\n$indent$indent";
$diagnostic .= "$problem->{parameter}" if $problem->{parameter};
- $diagnostic .= " near line $problem->{-line}";
+ $diagnostic .= " near line $problem->{-line} of "
+ . $filename;
$diagnostic .= " $problem->{comment}" if $problem->{comment};
}
$diagnostic .= "\n";
}
ok(@diagnostics == $thankful_diagnostics, $output);
if (@diagnostics) {
- note(join "", @diagnostics,
+ diag(join "", @diagnostics,
"See end of this test output for your options on silencing this");
}
: "were $were_count_files files";
my $message = <<EOF;
-HOW TO GET THIS .t TO PASS
+HOW TO GET ${\__FILE__} TO PASS
There $were_count_files that had new potential problems identified.
Some of them may be real, and some of them may be false positives because
and change the count of known potential problems to -1.
EOF
- note($message);
+ diag($message);
} elsif (%files_with_fixes) {
- note(<<EOF
+ diag(<<EOF
To teach this test script that the potential problems have been fixed,
$how_to
EOF