summaryrefslogtreecommitdiff
path: root/cpan/podlators
diff options
context:
space:
mode:
authorreneeb <info@perl-services.de>2023-01-20 01:28:36 +0100
committerreneeb <info@perl-services.de>2023-01-20 01:28:36 +0100
commita9304318f3f5d9eb9fff1802003ba77fd7d7fc65 (patch)
treebb0414680b954c232e9b7dac06e2df03acd029a3 /cpan/podlators
parent8ecbef790f84a14bc004b3fcacd50f485432cbb9 (diff)
downloadperl-a9304318f3f5d9eb9fff1802003ba77fd7d7fc65.tar.gz
update podlators to 5.01
Diffstat (limited to 'cpan/podlators')
-rw-r--r--cpan/podlators/Makefile.PL35
-rw-r--r--cpan/podlators/docs/docknot.yaml5
-rw-r--r--cpan/podlators/lib/Pod/Man.pm344
-rw-r--r--cpan/podlators/lib/Pod/ParseLink.pm2
-rw-r--r--cpan/podlators/lib/Pod/Text.pm71
-rw-r--r--cpan/podlators/lib/Pod/Text/Color.pm2
-rw-r--r--cpan/podlators/lib/Pod/Text/Overstrike.pm2
-rw-r--r--cpan/podlators/lib/Pod/Text/Termcap.pm2
-rw-r--r--cpan/podlators/scripts/pod2man.PL2
-rw-r--r--cpan/podlators/scripts/pod2text.PL37
-rw-r--r--cpan/podlators/t/data/basic.cap2
-rw-r--r--cpan/podlators/t/data/basic.clr9
-rw-r--r--cpan/podlators/t/data/basic.man59
-rw-r--r--cpan/podlators/t/data/basic.ovr9
-rw-r--r--cpan/podlators/t/data/basic.txt9
-rw-r--r--cpan/podlators/t/data/man/encoding.groff4
-rw-r--r--cpan/podlators/t/data/man/encoding.roff4
-rw-r--r--cpan/podlators/t/data/man/encoding.utf84
-rw-r--r--cpan/podlators/t/data/perl.conf13
-rw-r--r--cpan/podlators/t/data/perlcriticrc125
-rw-r--r--cpan/podlators/t/data/perltidyrc30
-rw-r--r--cpan/podlators/t/data/snippets/man/agrave2
-rw-r--r--cpan/podlators/t/data/snippets/man/bullet-after-nonbullet4
-rw-r--r--cpan/podlators/t/data/snippets/man/bullets6
-rw-r--r--cpan/podlators/t/data/snippets/man/c-in-name2
-rw-r--r--cpan/podlators/t/data/snippets/man/cpp2
-rw-r--r--cpan/podlators/t/data/snippets/man/error-die4
-rw-r--r--cpan/podlators/t/data/snippets/man/error-none4
-rw-r--r--cpan/podlators/t/data/snippets/man/error-normal4
-rw-r--r--cpan/podlators/t/data/snippets/man/error-pod4
-rw-r--r--cpan/podlators/t/data/snippets/man/error-stderr4
-rw-r--r--cpan/podlators/t/data/snippets/man/error-stderr-opt4
-rw-r--r--cpan/podlators/t/data/snippets/man/fixed-font-in-item4
-rw-r--r--cpan/podlators/t/data/snippets/man/guesswork2
-rw-r--r--cpan/podlators/t/data/snippets/man/guesswork-all2
-rw-r--r--cpan/podlators/t/data/snippets/man/guesswork-no-quoting2
-rw-r--r--cpan/podlators/t/data/snippets/man/guesswork-none2
-rw-r--r--cpan/podlators/t/data/snippets/man/guesswork-partial2
-rw-r--r--cpan/podlators/t/data/snippets/man/guesswork-quoting2
-rw-r--r--cpan/podlators/t/data/snippets/man/iso-8859-12
-rw-r--r--cpan/podlators/t/data/snippets/man/iso-8859-1-error-die2
-rw-r--r--cpan/podlators/t/data/snippets/man/iso-8859-1-error-pod2
-rw-r--r--cpan/podlators/t/data/snippets/man/iso-8859-1-roff2
-rw-r--r--cpan/podlators/t/data/snippets/man/language2
-rw-r--r--cpan/podlators/t/data/snippets/man/long-quote4
-rw-r--r--cpan/podlators/t/data/snippets/man/markup-in-name2
-rw-r--r--cpan/podlators/t/data/snippets/man/name-guesswork4
-rw-r--r--cpan/podlators/t/data/snippets/man/name-quotes2
-rw-r--r--cpan/podlators/t/data/snippets/man/name-quotes-none2
-rw-r--r--cpan/podlators/t/data/snippets/man/nested-lists2
-rw-r--r--cpan/podlators/t/data/snippets/man/non-ascii2
-rw-r--r--cpan/podlators/t/data/snippets/man/nonbreaking-space-l2
-rw-r--r--cpan/podlators/t/data/snippets/man/not-bullet2
-rw-r--r--cpan/podlators/t/data/snippets/man/periods2
-rw-r--r--cpan/podlators/t/data/snippets/man/utf8-verbatim2
-rw-r--r--cpan/podlators/t/data/snippets/man/x-whitespace-entry2
-rw-r--r--cpan/podlators/t/data/snippets/text/guesswork-no-quoting39
-rw-r--r--cpan/podlators/t/data/snippets/text/guesswork-quoting34
-rw-r--r--cpan/podlators/t/general/filehandle.t10
-rw-r--r--cpan/podlators/t/general/pod-parser.t4
-rw-r--r--cpan/podlators/t/lib/Test/Podlators.pm121
-rw-r--r--cpan/podlators/t/man/devise-date.t22
-rw-r--r--cpan/podlators/t/man/empty.t12
-rw-r--r--cpan/podlators/t/man/heading.t28
-rw-r--r--cpan/podlators/t/man/iso-8859-1.t4
-rw-r--r--cpan/podlators/t/man/no-encode.t18
-rw-r--r--cpan/podlators/t/man/snippets.t22
-rw-r--r--cpan/podlators/t/parselink/basic.t36
-rw-r--r--cpan/podlators/t/style/critic.t87
-rw-r--r--cpan/podlators/t/style/kwalitee.t56
-rw-r--r--cpan/podlators/t/text/invalid.t4
-rw-r--r--cpan/podlators/t/text/iso-8859-1.t2
-rw-r--r--cpan/podlators/t/text/snippets.t13
-rw-r--r--cpan/podlators/t/text/termcap.t18
-rw-r--r--cpan/podlators/t/text/utf8-io.t12
75 files changed, 939 insertions, 467 deletions
diff --git a/cpan/podlators/Makefile.PL b/cpan/podlators/Makefile.PL
index 93fcd4f9d9..36e47ab18d 100644
--- a/cpan/podlators/Makefile.PL
+++ b/cpan/podlators/Makefile.PL
@@ -81,7 +81,8 @@ sub man1pod {
# The hash of all the metadata. This will be modified before WriteMakefile to
# remove keys not supported by the local version of ExtUtils::MakeMaker.
my $dist_version = dist_version();
-my %metadata = (
+my %metadata = (
+ #<<<
NAME => 'Pod',
DISTNAME => 'podlators',
ABSTRACT => 'Convert POD data to various other formats',
@@ -90,6 +91,7 @@ my %metadata = (
EXE_FILES => [scripts('pod2text', 'pod2man')],
VERSION_FROM => 'lib/Pod/Man.pm',
MIN_PERL_VERSION => '5.010',
+ #>>>
# Use *.PL files to generate the driver scripts so that we get the correct
# invocation of Perl on non-UNIX platforms.
@@ -107,11 +109,11 @@ my %metadata = (
},
# Clean some additional files.
- clean => { FILES => File::Spec->catdir('t', 'tmp') },
+ clean => { FILES => File::Spec->catdir('t', 'tmp') },
realclean => { FILES => scalar(scripts('pod2text', 'pod2man')) },
# Dependencies on other modules.
- PREREQ_PM => { 'Pod::Simple' => 3.06 },
+ PREREQ_PM => { 'Pod::Simple' => 3.26 },
# Older versions of ExtUtils::MakeMaker don't pick up nested test
# directories by default.
@@ -125,41 +127,40 @@ my %metadata = (
# Additional metadata.
META_ADD => {
'meta-spec' => { version => 2 },
- provides => {
+ provides => {
'Pod::Man' => {
- file => 'lib/Pod/Man.pm',
+ file => 'lib/Pod/Man.pm',
version => $dist_version,
},
'Pod::ParseLink' => {
- file => 'lib/Pod/ParseLink.pm',
+ file => 'lib/Pod/ParseLink.pm',
version => $dist_version,
},
'Pod::Text' => {
- file => 'lib/Pod/Text.pm',
+ file => 'lib/Pod/Text.pm',
version => $dist_version,
},
'Pod::Text::Color' => {
- file => 'lib/Pod/Text/Color.pm',
+ file => 'lib/Pod/Text/Color.pm',
version => $dist_version,
},
'Pod::Text::Overstrike' => {
- file => 'lib/Pod/Text/Overstrike.pm',
+ file => 'lib/Pod/Text/Overstrike.pm',
version => $dist_version,
},
'Pod::Text::Termcap' => {
- file => 'lib/Pod/Text/Termcap.pm',
+ file => 'lib/Pod/Text/Termcap.pm',
version => $dist_version,
},
},
resources => {
bugtracker => {
- mailto => 'bug-podlators@rt.cpan.org',
- web => 'https://rt.cpan.org/Dist/Display.html?Name=podlators',
+ web => 'https://github.com/rra/podlators/issues',
},
- homepage => 'https://www.eyrie.org/~eagle/software/podlators/',
+ homepage => 'https://www.eyrie.org/~eagle/software/podlators/',
repository => {
- url => 'https://github.com/rra/podlators.git',
- web => 'https://github.com/rra/podlators',
+ url => 'https://github.com/rra/podlators.git',
+ web => 'https://github.com/rra/podlators',
type => 'git',
},
},
@@ -169,8 +170,8 @@ my %metadata = (
# Remove keys that aren't supported by this version of ExtUtils::MakeMaker.
# This hash maps keys to the minimum supported version.
my %supported = (
- LICENSE => 6.31,
- META_ADD => 6.46,
+ LICENSE => 6.31,
+ META_ADD => 6.46,
MIN_PERL_VERSION => 6.48,
);
for my $key (keys(%supported)) {
diff --git a/cpan/podlators/docs/docknot.yaml b/cpan/podlators/docs/docknot.yaml
index 4dcb50e2da..0249637501 100644
--- a/cpan/podlators/docs/docknot.yaml
+++ b/cpan/podlators/docs/docknot.yaml
@@ -15,7 +15,7 @@ format: v1
name: podlators
maintainer: Russ Allbery <rra@cpan.org>
-version: '5.00'
+version: '5.01'
synopsis: format POD source into various output formats
license:
@@ -119,7 +119,8 @@ description: |
example).
requirements: |
- This module requires Perl 5.10 or later.
+ This module requires Perl 5.10 or later and Pod::Simple 3.26 or later.
+ (Pod::Simple 3.26 was included in Perl 5.17.10.)
The troff/nroff generated by Pod::Man should be compatible with any troff or
nroff implementation with the `-man` macro set, including mandoc. It is
diff --git a/cpan/podlators/lib/Pod/Man.pm b/cpan/podlators/lib/Pod/Man.pm
index 57be69f600..5ed95bbc90 100644
--- a/cpan/podlators/lib/Pod/Man.pm
+++ b/cpan/podlators/lib/Pod/Man.pm
@@ -30,7 +30,7 @@ BEGIN {
}
our @ISA = qw(Pod::Simple);
-our $VERSION = '5.00';
+our $VERSION = '5.01';
# Ensure that $Pod::Simple::nbsp and $Pod::Simple::shy are available. Code
# taken from Pod::Simple 3.32, but was only added in 3.30.
@@ -48,9 +48,6 @@ if ($Pod::Simple::VERSION ge 3.30) {
# generally only false for EBCDIC.
BEGIN { *ASCII = \&Pod::Simple::ASCII }
-# Pretty-print a data structure. Only used for debugging.
-BEGIN { *pretty = \&Pod::Simple::pretty }
-
# Formatting instructions for various types of blocks. cleanup makes hyphens
# hard, adds spaces between consecutive underscores, and escapes backslashes.
# convert translates characters into escapes. guesswork means to apply the
@@ -144,6 +141,20 @@ my %ESCAPES;
# Utility functions
##############################################################################
+# Quote an argument to a macro.
+#
+# $arg - Intended argument to the macro
+#
+# Returns: $arg suitably escaped and quoted
+sub _quote_macro_argument {
+ my ($arg) = @_;
+ if (length($arg) > 0 && $arg !~ m{ [\s\"] }xms) {
+ return $arg;
+ }
+ $arg =~ s{ \" }{""}xmsg;
+ return qq("$arg");
+}
+
# Returns whether the given encoding needs a call to Encode::encode.
sub _needs_encode {
my ($encoding) = @_;
@@ -275,29 +286,41 @@ sub init_fonts {
# Figure out the fixed-width font. If user-supplied, make sure that they
# are the right length.
- for (qw/fixed fixedbold fixeditalic fixedbolditalic/) {
+ for (qw(fixed fixedbold fixeditalic fixedbolditalic)) {
my $font = $self->{"opt_$_"};
- if (defined ($font) && (length ($font) < 1 || length ($font) > 2)) {
- croak qq(roff font should be 1 or 2 chars, not "$font");
+ if (defined($font) && (length($font) < 1 || length($font) > 2)) {
+ croak(qq(roff font should be 1 or 2 chars, not "$font"));
}
}
# Set the default fonts. We can't be sure portably across different
# implementations what fixed bold-italic may be called (if it's even
# available), so default to just bold.
+ #<<<
$self->{opt_fixed} ||= 'CW';
$self->{opt_fixedbold} ||= 'CB';
$self->{opt_fixeditalic} ||= 'CI';
$self->{opt_fixedbolditalic} ||= 'CB';
+ #>>>
# Set up a table of font escapes. First number is fixed-width, second is
# bold, third is italic.
- $$self{FONTS} = { '000' => '\fR', '001' => '\fI',
- '010' => '\fB', '011' => '\f(BI',
- '100' => toescape ($self->{opt_fixed}),
- '101' => toescape ($self->{opt_fixeditalic}),
- '110' => toescape ($self->{opt_fixedbold}),
- '111' => toescape ($self->{opt_fixedbolditalic}) };
+ $self->{FONTS} = {
+ '000' => '\fR',
+ '001' => '\fI',
+ '010' => '\fB',
+ '011' => '\f(BI',
+ '100' => toescape($self->{opt_fixed}),
+ '101' => toescape($self->{opt_fixeditalic}),
+ '110' => toescape($self->{opt_fixedbold}),
+ '111' => toescape($self->{opt_fixedbolditalic}),
+ };
+
+ # Precalculate a regex that matches all fixed-width fonts, which will be
+ # used later by switchquotes.
+ my @fixedpat = map { quotemeta($self->{FONTS}{$_}) } qw(100 101 110 111);
+ my $fixedpat = join('|', @fixedpat);
+ $self->{FIXEDPAT} = qr{ $fixedpat }xms;
}
# Initialize the quotes that we'll be using for C<> text. This requires some
@@ -330,12 +353,6 @@ sub init_quotes {
$self->{opt_rquote} = q{} if $self->{opt_rquote} eq 'none';
$$self{RQUOTE} = $self->{opt_rquote};
}
-
- # Double the first quote; note that this should not be s///g as two double
- # quotes is represented in *roff as three double quotes, not four. Weird,
- # I know.
- $$self{LQUOTE} =~ s/\"/\"\"/;
- $$self{RQUOTE} =~ s/\"/\"\"/;
}
# Initialize the page title information and indentation from our arguments.
@@ -352,11 +369,6 @@ sub init_page {
$self->{opt_center} //= 'User Contributed Perl Documentation';
$self->{opt_release} //= 'perl v' . $version;
$self->{opt_indent} //= 4;
-
- # Double quotes in things that will be quoted.
- for (qw/center release/) {
- $self->{"opt_$_"} =~ s/\"/\"\"/g if $self->{"opt_$_"};
- }
}
##############################################################################
@@ -512,9 +524,7 @@ sub quote_literal {
# If in NAME section, just return an ASCII quoted string to avoid
# confusing tools like whatis.
if ($$self{IN_NAME}) {
- my $lquote = $$self{LQUOTE} eq '""' ? '"' : $$self{LQUOTE};
- my $rquote = $$self{RQUOTE} eq '""' ? '"' : $$self{RQUOTE};
- return $lquote . $_ . $rquote;
+ return $self->{LQUOTE} . $_ . $self->{RQUOTE};
}
# A regex that matches the portion of a variable reference that's the
@@ -559,8 +569,7 @@ sub quote_literal {
# formatting codes added. This is the code that marks up various Perl
# constructs and things commonly used in man pages without requiring the user
# to add any explicit markup, and is applied to all non-literal text. Note
-# that the inserted font sequences must be treated later with mapfonts or
-# textmapfonts.
+# that the inserted font sequences must be treated later with mapfonts.
#
# This method is very fragile, both in the regular expressions it uses and in
# the ordering of those modifications. Care and testing is required when
@@ -648,72 +657,52 @@ sub guesswork {
# the right start and end codes.
#
# We add this level of complexity because the old pod2man didn't get code like
-# B<someI<thing> else> right; after I<> it switched back to normal text rather
-# than bold. We take care of this by using variables that state whether bold,
-# italic, or fixed are turned on as a combined pointer to our current font
-# sequence, and set each to the number of current nestings of start tags for
-# that font.
+# B<< someI<thing> else>> right. After I<> it switched back to normal text
+# rather than bold. We take care of this by using variables that state
+# whether bold, italic, or fixed are turned on as a combined pointer to our
+# current font sequence, and set each to the number of current nestings of
+# start tags for that font.
#
-# \fP changes to the previous font, but only one previous font is kept. We
-# don't know what the outside level font is; normally it's R, but if we're
-# inside a heading it could be something else. So arrange things so that the
-# outside font is always the "previous" font and end with \fP instead of \fR.
-# Idea from Zack Weinberg.
+# The base font must be either \fP or \fR. \fP changes to the previous font,
+# but only one previous font is kept. Unfortunately, there is a bug in
+# Solaris 2.6 nroff (not present in GNU groff) where the sequence
+# \fB\fP\f(CW\fP leaves the font set to B rather than R, presumably because
+# \f(CW doesn't actually do a font change. Because of this, we prefer to use
+# \fR where possible.
+#
+# Unfortunately, this isn't possible for arguments to heading macros, since
+# there we don't know what the outside level font is. In that case, arrange
+# things so that the outside font is always the "previous" font and end with
+# \fP instead of \fR. Idea from Zack Weinberg.
+#
+# This function used to be much simpler outside of macro arguments because it
+# went directly from \fB to \f(CW and relied on \f(CW clearing bold since it
+# wasn't \f(CB. Unfortunately, while this works for mandoc, this is not how
+# groff works; \fBfoo\f(CWbar still prints bar in bold. Therefore, we force
+# the font back to the base font before each font change.
sub mapfonts {
- my ($self, $text) = @_;
- my ($fixed, $bold, $italic) = (0, 0, 0);
- my %magic = (F => \$fixed, B => \$bold, I => \$italic);
- my $last = '\fR';
- $text =~ s{
- \\f\((.)(.)
- }{
- my $sequence = '';
- my $f;
- if ($last ne '\fR') { $sequence = '\fP' }
- ${ $magic{$1} } += ($2 eq 'S') ? 1 : -1;
- $f = $$self{FONTS}{ ($fixed && 1) . ($bold && 1) . ($italic && 1) };
- if ($f eq $last) {
- '';
- } else {
- if ($f ne '\fR') { $sequence .= $f }
- $last = $f;
- $sequence;
- }
- }gxe;
- return $text;
-}
+ my ($self, $text, $base) = @_;
-# Unfortunately, there is a bug in Solaris 2.6 nroff (not present in GNU
-# groff) where the sequence \fB\fP\f(CW\fP leaves the font set to B rather
-# than R, presumably because \f(CW doesn't actually do a font change. To work
-# around this, use a separate textmapfonts for text blocks that uses \fR
-# instead of \fP.
-#
-# Originally, this function was much simpler because it went directly from \fB
-# to \f(CW and relied on \f(CW clearing bold since it wasn't \f(CB.
-# Unfortunately, while this works for mandoc, this is not how groff works;
-# \fBfoo\f(CWbar still prints bar in bold. Therefore, we force the font back
-# to the default before each font change.
-sub textmapfonts {
- my ($self, $text) = @_;
+ # The closure used to process each font escape, expected to be called from
+ # the right-hand side of an s/// expression.
my ($fixed, $bold, $italic) = (0, 0, 0);
my %magic = (F => \$fixed, B => \$bold, I => \$italic);
my $last = '\fR';
- $text =~ s{
- \\f\((.)(.)
- }{
- my $sequence = q{};
- if ($last ne '\fR') { $sequence = '\fR' }
- ${ $magic{$1} } += ($2 eq 'S') ? 1 : -1;
- my $f = $$self{FONTS}{ ($fixed && 1) . ($bold && 1) . ($italic && 1) };
- if ($f eq $last) {
- '';
- } else {
- if ($f ne '\fR') { $sequence .= $f }
- $last = $f;
- $sequence;
+ my $process = sub {
+ my ($style, $start_stop) = @_;
+ my $sequence = ($last ne '\fR') ? $base : q{};
+ ${ $magic{$style} } += ($start_stop eq 'S') ? 1 : -1;
+ my $f = $self->{FONTS}{($fixed && 1) . ($bold && 1) . ($italic && 1)};
+ return q{} if ($f eq $last);
+ if ($f ne '\fR') {
+ $sequence .= $f;
}
- }gxe;
+ $last = $f;
+ return $sequence;
+ };
+
+ # Now, do the actual work.
+ $text =~ s{ \\f\((.)(.) }{$process->($1, $2)}xmsge;
# We can do a bit of cleanup by collapsing sequences like \fR\fB\fR\fI
# into just \fI.
@@ -723,57 +712,51 @@ sub textmapfonts {
}
# Given a command and a single argument that may or may not contain double
-# quotes, handle double-quote formatting for it. If there are no double
-# quotes, just return the command followed by the argument in double quotes.
-# If there are double quotes, use an if statement to test for nroff, and for
-# nroff output the command followed by the argument in double quotes with
-# embedded double quotes doubled. For other formatters, remap paired double
-# quotes to LQUOTE and RQUOTE.
+# quotes and fixed-width text, handle double-quote formatting for it. If
+# there is no fixed-width text, just return the command followed by the
+# argument with proper quoting. If there is fixed-width text, work around a
+# Solaris nroff bug with fixed-width fonts by converting fixed-width to
+# regular fonts (nroff sees no difference).
sub switchquotes {
my ($self, $command, $text, $extra) = @_;
- $text =~ s/\\\*\([LR]\"/\"/g;
-
- # We also have to deal with \*C` and \*C', which are used to add the
- # quotes around C<> text, since they may expand to " and if they do this
- # confuses the .SH macros and the like no end. Expand them ourselves.
- # Also separate troff from nroff if there are any fixed-width fonts in use
- # to work around problems with Solaris nroff.
- my $c_is_quote = ($$self{LQUOTE} =~ /\"/) || ($$self{RQUOTE} =~ /\"/);
- my $fixedpat = join '|', @{ $$self{FONTS} }{'100', '101', '110', '111'};
- $fixedpat =~ s/\\/\\\\/g;
- $fixedpat =~ s/\(/\\\(/g;
- if ($text =~ m/\"/ || $text =~ m/$fixedpat/) {
- $text =~ s/\"/\"\"/g;
+
+ # Separate troff from nroff if there are any fixed-width fonts in use to
+ # work around problems with Solaris nroff.
+ if ($text =~ $self->{FIXEDPAT}) {
my $nroff = $text;
my $troff = $text;
- $troff =~ s/\"\"([^\"]*)\"\"/\`\`$1\'\'/g;
- if ($c_is_quote and $text =~ m/\\\*\(C[\'\`]/) {
- $nroff =~ s/\\\*\(C\`/$$self{LQUOTE}/g;
- $nroff =~ s/\\\*\(C\'/$$self{RQUOTE}/g;
- $troff =~ s/\\\*\(C[\'\`]//g;
- }
- $nroff = qq("$nroff") . ($extra ? " $extra" : '');
- $troff = qq("$troff") . ($extra ? " $extra" : '');
# Work around the Solaris nroff bug where \f(CW\fP leaves the font set
# to Roman rather than the actual previous font when used in headings.
# troff output may still be broken, but at least we can fix nroff by
# just switching the font changes to the non-fixed versions.
- my $font_end = "(?:\\f[PR]|\Q$$self{FONTS}{100}\E)";
- $nroff =~ s/\Q$$self{FONTS}{100}\E(.*?)\\f([PR])/$1/g;
- $nroff =~ s/\Q$$self{FONTS}{101}\E(.*?)$font_end/\\fI$1\\fP/g;
- $nroff =~ s/\Q$$self{FONTS}{110}\E(.*?)$font_end/\\fB$1\\fP/g;
- $nroff =~ s/\Q$$self{FONTS}{111}\E(.*?)$font_end/\\f\(BI$1\\fP/g;
+ my $font_end = qr{ (?: \\f[PR] | \Q$self->{FONTS}{100}\E ) }xms;
+ $nroff =~ s{\Q$self->{FONTS}{100}\E(.*?)\\f([PR])}{$1}xmsg;
+ $nroff =~ s{\Q$self->{FONTS}{101}\E}{\\fI}xmsg;
+ $nroff =~ s{\Q$self->{FONTS}{110}\E}{\\fB}xmsg;
+ $nroff =~ s{\Q$self->{FONTS}{111}\E}{\\f\(BI}xmsg;
+
+ # We have to deal with \*C` and \*C', which are used to add the quotes
+ # around C<> text, since they may expand to " and if they do this
+ # confuses the .SH macros and the like no end. Expand them ourselves.
+ my $c_is_quote = index("$self->{LQUOTE}$self->{RQUOTE}", qq(\")) != -1;
+ if ($c_is_quote && $text =~ m{ \\[*]\(C[\'\`] }xms) {
+ $nroff =~ s{ \\[*]\(C\` }{$self->{LQUOTE}}xmsg;
+ $nroff =~ s{ \\[*]\(C\' }{$self->{RQUOTE}}xmsg;
+ $troff =~ s{ \\[*]\(C[\'\`] }{}xmsg;
+ }
# Now finally output the command. Bother with .ie only if the nroff
# and troff output aren't the same.
+ $nroff = _quote_macro_argument($nroff) . ($extra ? " $extra" : '');
+ $troff = _quote_macro_argument($troff) . ($extra ? " $extra" : '');
if ($nroff ne $troff) {
return ".ie n $command $nroff\n.el $command $troff\n";
} else {
return "$command $nroff\n";
}
} else {
- $text = qq("$text") . ($extra ? " $extra" : '');
+ $text = _quote_macro_argument($text) . ($extra ? " $extra" : '');
return "$command $text\n";
}
}
@@ -1070,48 +1053,50 @@ sub preamble {
my ($self, $name, $section, $date) = @_;
my $preamble = $self->preamble_template();
- # Build the index line and make sure that it will be syntactically valid.
- my $index = "$name $section";
- $index =~ s/\"/\"\"/g;
-
- # If name or section contain spaces, quote them (section really never
- # should, but we may as well be cautious).
- for ($name, $section) {
- if (/\s/) {
- s/\"/\"\"/g;
- $_ = '"' . $_ . '"';
- }
- }
-
- # Double quotes in date, since it will be quoted.
- $date =~ s/\"/\"\"/g;
-
- # Substitute into the preamble the configuration options.
- $preamble =~ s/\@CFONT\@/$self->{opt_fixed}/;
- $preamble =~ s/\@LQUOTE\@/$$self{LQUOTE}/;
- $preamble =~ s/\@RQUOTE\@/$$self{RQUOTE}/;
- chomp $preamble;
-
- # Get the version information.
- my $version = $self->version_report;
-
# groff's preconv script will use this line to correctly determine the
# input encoding if the encoding is one of the ones it recognizes. It
# must be the first or second line.
#
# If the output encoding is some version of Unicode, we could also add a
- # Unicode Byte Order Mark to the start of the file, but I am concerned
- # that may break a *roff implementation that might otherwise cope with
- # Unicode. Revisit this if someone files a bug report about it.
+ # Unicode Byte Order Mark to the start of the file, but the BOM is now
+ # deprecated and I am concerned that may break a *roff implementation that
+ # might otherwise cope with Unicode. Revisit this if someone files a bug
+ # report about it.
if (_needs_encode($$self{ENCODING})) {
my $normalized = lc($$self{ENCODING});
$normalized =~ s{-}{}g;
my $coding = $ENCODINGS{$normalized} || lc($$self{ENCODING});
if ($coding ne 'us-ascii') {
- $self->output (qq{.\\\" -*- mode: troff; coding: $coding -*-\n});
+ $self->output(qq{.\\\" -*- mode: troff; coding: $coding -*-\n});
}
}
+ # Substitute into the preamble the configuration options. Because it's
+ # used as the argument to defining a string, any leading double quote (but
+ # no other double quotes) in LQUOTE and RQUOTE has to be doubled.
+ $preamble =~ s{ [@] CFONT [@] }{$self->{opt_fixed}}xms;
+ my $lquote = $self->{LQUOTE};
+ my $rquote = $self->{RQUOTE};
+ $lquote =~ s{ \A \" }{""}xms;
+ $rquote =~ s{ \A \" }{""}xms;
+ $preamble =~ s{ [@] LQUOTE [@] }{$lquote}xms;
+ $preamble =~ s{ [@] RQUOTE [@] }{$rquote}xms;
+ chomp($preamble);
+
+ # Get the version information.
+ my $version = $self->version_report();
+
+ # Build the index line and make sure that it will be syntactically valid.
+ my $index = _quote_macro_argument("$name $section");
+
+ # Quote the arguments to the .TH macro. (Section should never require
+ # this, but we may as well be cautious.)
+ $name = _quote_macro_argument($name);
+ $section = _quote_macro_argument($section);
+ $date = _quote_macro_argument($date);
+ my $center = _quote_macro_argument($self->{opt_center});
+ my $release = _quote_macro_argument($self->{opt_release});
+
# Output the majority of the preamble.
$self->output (<<"----END OF HEADER----");
.\\" Automatically generated by $version
@@ -1121,8 +1106,8 @@ sub preamble {
$preamble
.\\" ========================================================================
.\\"
-.IX Title "$index"
-.TH $name $section "$date" "$self->{opt_release}" "$self->{opt_center}"
+.IX Title $index
+.TH $name $section $date $release $center
.\\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\\" way too many mistakes in technical documents.
.if n .ad l
@@ -1167,8 +1152,8 @@ sub cmd_para {
$text = reverse $text;
# Output the paragraph.
- $self->output ($self->protect ($self->textmapfonts ($text)));
- $self->outindex;
+ $self->output($self->protect($self->mapfonts($text, '\fR')));
+ $self->outindex();
$$self{NEEDSPACE} = 1;
return '';
}
@@ -1180,45 +1165,44 @@ sub cmd_verbatim {
my ($self, $attrs, $text) = @_;
# Ignore an empty verbatim paragraph.
- return unless $text =~ /\S/;
+ return if $text !~ m{ \S }xms;
# Force exactly one newline at the end and strip unwanted trailing
- # whitespace at the end. Reverse the text first, to avoid having to scan
- # the entire paragraph.
- $text = reverse $text;
- $text =~ s/\A\s*/\n/;
- $text = reverse $text;
+ # whitespace at the end.
+ $text =~ s{ \s* \z }{\n}xms;
# Get a count of the number of lines before the first blank line, which
# we'll pass to .Vb as its parameter. This tells *roff to keep that many
# lines together. We don't want to tell *roff to keep huge blocks
# together.
- my @lines = split (/\n/, $text);
+ my @lines = split (m{ \n }xms, $text);
my $unbroken = 0;
- for (@lines) {
- last if /^\s*$/;
+ for my $line (@lines) {
+ last if $line =~ m{ \A \s* \z }xms;
$unbroken++;
}
- $unbroken = 10 if ($unbroken > 12 && !$$self{MAGIC_VNOPAGEBREAK_LIMIT});
+ if ($unbroken > 12) {
+ $unbroken = 10;
+ }
- # Prepend a null token to each line.
- $text =~ s/^/\\&/gm;
+ # Prepend a null token to each line to preserve indentation.
+ $text =~ s{ ^ }{\\&}xmsg;
# Output the results.
- $self->makespace;
- $self->output (".Vb $unbroken\n$text.Ve\n");
+ $self->makespace();
+ $self->output(".Vb $unbroken\n$text.Ve\n");
$$self{NEEDSPACE} = 1;
- return '';
+ return q{};
}
# Handle literal text (produced by =for and similar constructs). Just output
# it with the minimum of changes.
sub cmd_data {
my ($self, $attrs, $text) = @_;
- $text =~ s/^\n+//;
- $text =~ s/\n{0,2}$/\n/;
- $self->output ($text);
- return '';
+ $text =~ s{ \A \n+ }{}xms;
+ $text =~ s{ \n{0,2} \z }{\n}xms;
+ $self->output($text);
+ return q{};
}
##############################################################################
@@ -1252,7 +1236,7 @@ sub cmd_head1 {
$text =~ s/\\s-?\d//g;
$text = $self->heading_common ($text, $$attrs{start_line});
my $isname = ($text eq 'NAME' || $text =~ /\(NAME\)/);
- $self->output ($self->switchquotes ('.SH', $self->mapfonts ($text)));
+ $self->output($self->switchquotes('.SH', $self->mapfonts($text, '\fP')));
$self->outindex ('Header', $text) unless $isname;
$$self{NEEDSPACE} = 0;
$$self{IN_NAME} = $isname;
@@ -1263,7 +1247,7 @@ sub cmd_head1 {
sub cmd_head2 {
my ($self, $attrs, $text) = @_;
$text = $self->heading_common ($text, $$attrs{start_line});
- $self->output ($self->switchquotes ('.SS', $self->mapfonts ($text)));
+ $self->output($self->switchquotes('.SS', $self->mapfonts($text, '\fP')));
$self->outindex ('Subsection', $text);
$$self{NEEDSPACE} = 0;
return '';
@@ -1275,7 +1259,7 @@ sub cmd_head3 {
my ($self, $attrs, $text) = @_;
$text = $self->heading_common ($text, $$attrs{start_line});
$self->makespace;
- $self->output ($self->textmapfonts ('\f(IS' . $text . '\f(IE') . "\n");
+ $self->output($self->mapfonts('\f(IS' . $text . '\f(IE', '\fR') . "\n");
$self->outindex ('Subsection', $text);
$$self{NEEDSPACE} = 1;
return '';
@@ -1287,7 +1271,7 @@ sub cmd_head4 {
my ($self, $attrs, $text) = @_;
$text = $self->heading_common ($text, $$attrs{start_line});
$self->makespace;
- $self->output ($self->textmapfonts ($text) . "\n");
+ $self->output($self->mapfonts($text, '\fR') . "\n");
$self->outindex ('Subsection', $text);
$$self{NEEDSPACE} = 1;
return '';
@@ -1454,8 +1438,8 @@ sub item_common {
$self->output (".PD 0\n") if ($$self{ITEMS} == 1);
# Now, output the item tag itself.
- $item = $self->textmapfonts ($item);
- $self->output ($self->switchquotes ('.IP', $item, $$self{INDENT}));
+ $item = $self->mapfonts($item, '\fR');
+ $self->output($self->switchquotes('.IP', $item, $$self{INDENT}));
$$self{NEEDSPACE} = 0;
$$self{ITEMS}++;
$$self{SHIFTWAIT} = 0;
@@ -1464,7 +1448,7 @@ sub item_common {
if ($text) {
$text =~ s/\s*$/\n/;
$self->makespace;
- $self->output ($self->protect ($self->textmapfonts ($text)));
+ $self->output($self->protect($self->mapfonts($text, '\fR')));
$$self{NEEDSPACE} = 1;
}
$self->outindex ($index ? ('Item', $index) : ());
diff --git a/cpan/podlators/lib/Pod/ParseLink.pm b/cpan/podlators/lib/Pod/ParseLink.pm
index c4220a8d65..83bc3f7565 100644
--- a/cpan/podlators/lib/Pod/ParseLink.pm
+++ b/cpan/podlators/lib/Pod/ParseLink.pm
@@ -21,7 +21,7 @@ use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(parselink);
-our $VERSION = '5.00';
+our $VERSION = '5.01';
##############################################################################
# Implementation
diff --git a/cpan/podlators/lib/Pod/Text.pm b/cpan/podlators/lib/Pod/Text.pm
index 85b4e53c51..83a7ce22a8 100644
--- a/cpan/podlators/lib/Pod/Text.pm
+++ b/cpan/podlators/lib/Pod/Text.pm
@@ -24,7 +24,7 @@ use Exporter ();
use Pod::Simple ();
our @ISA = qw(Pod::Simple Exporter);
-our $VERSION = '5.00';
+our $VERSION = '5.01';
# We have to export pod2text for backward compatibility.
our @EXPORT = qw(pod2text);
@@ -141,6 +141,17 @@ sub new {
croak qq(Invalid quote specification "$$self{opt_quotes}");
}
+ # Configure guesswork based on options.
+ my $guesswork = $self->{opt_guesswork} || q{};
+ my %guesswork = map { $_ => 1 } split(m{,}xms, $guesswork);
+ if (!%guesswork || $guesswork{all}) {
+ $$self{GUESSWORK} = {quoting => 1};
+ } elsif ($guesswork{none}) {
+ $$self{GUESSWORK} = {};
+ } else {
+ $$self{GUESSWORK} = {%guesswork};
+ }
+
# If requested, do something with the non-POD text.
$self->code_handler (\&handle_code) if $$self{opt_code};
@@ -622,23 +633,35 @@ sub cmd_c {
# A regex that matches the portion of a variable reference that's the
# array or hash index, separated out just because we want to use it in
# several places in the following regex.
- my $index = '(?: \[.*\] | \{.*\} )?';
+ my $index = '(?: \[[^]]+\] | \{[^}]+\} )?';
# Check for things that we don't want to quote, and if we find any of
# them, return the string with just a font change and no quoting.
+ #
+ # Traditionally, Pod::Text has not quoted Perl variables, functions,
+ # numbers, or hex constants, but this is not always desirable. Make this
+ # optional on the quoting guesswork flag.
+ my $extra = qr{(?!)}xms; # never matches
+ if ($$self{GUESSWORK}{quoting}) {
+ $extra = qr{
+ \$+ [\#^]? \S $index # special ($^F, $")
+ | [\$\@%&*]+ \#? [:\'\w]+ $index # plain var or func
+ | [\$\@%&*]* [:\'\w]+
+ (?: -> )? \(\s*[^\s,\)]*\s*\) # 0/1-arg func call
+ | [+-]? ( \d[\d.]* | \.\d+ )
+ (?: [eE][+-]?\d+ )? # a number
+ | 0x [a-fA-F\d]+ # a hex constant
+ }xms;
+ }
$text =~ m{
^\s*
(?:
- ( [\'\`\"] ) .* \1 # already quoted
- | \` .* \' # `quoted'
- | \$+ [\#^]? \S $index # special ($^Foo, $")
- | [\$\@%&*]+ \#? [:\'\w]+ $index # plain var or func
- | [\$\@%&*]* [:\'\w]+ (?: -> )? \(\s*[^\s,]\s*\) # 0/1-arg func call
- | [+-]? ( \d[\d.]* | \.\d+ ) (?: [eE][+-]?\d+ )? # a number
- | 0x [a-fA-F\d]+ # a hex constant
+ ( [\'\`\"] ) .* \1 # already quoted
+ | \` .* \' # `quoted'
+ | $extra
)
\s*\z
- }xo && return $text;
+ }xms and return $text;
# If we didn't return, go ahead and quote the text.
return $$self{opt_alt}
@@ -931,6 +954,34 @@ entirely, as much as possible.
The default is C<pod>.
+=item guesswork
+
+[5.01] By default, Pod::Text applies some default formatting rules based on
+guesswork and regular expressions that are intended to make writing Perl
+documentation easier and require less explicit markup. These rules may not
+always be appropriate, particularly for documentation that isn't about Perl.
+This option allows turning all or some of it off.
+
+The special value C<all> enables all guesswork. This is also the default for
+backward compatibility reasons. The special value C<none> disables all
+guesswork. Otherwise, the value of this option should be a comma-separated
+list of one or more of the following keywords:
+
+=over 4
+
+=item quoting
+
+If no guesswork is enabled, any text enclosed in CZ<><> is surrounded by
+double quotes in nroff (terminal) output unless the contents are already
+quoted. When this guesswork is enabled, quote marks will also be suppressed
+for Perl variables, function names, function calls, numbers, and hex
+constants.
+
+=back
+
+Any unknown guesswork name is silently ignored (for potential future
+compatibility), so be careful about spelling.
+
=item indent
[2.00] The number of spaces to indent regular text, and the default
diff --git a/cpan/podlators/lib/Pod/Text/Color.pm b/cpan/podlators/lib/Pod/Text/Color.pm
index b340c5030c..2d656d6a3d 100644
--- a/cpan/podlators/lib/Pod/Text/Color.pm
+++ b/cpan/podlators/lib/Pod/Text/Color.pm
@@ -20,7 +20,7 @@ use Pod::Text ();
use Term::ANSIColor qw(color colored);
our @ISA = qw(Pod::Text);
-our $VERSION = '5.00';
+our $VERSION = '5.01';
##############################################################################
# Overrides
diff --git a/cpan/podlators/lib/Pod/Text/Overstrike.pm b/cpan/podlators/lib/Pod/Text/Overstrike.pm
index a06f46feb6..3135c8863c 100644
--- a/cpan/podlators/lib/Pod/Text/Overstrike.pm
+++ b/cpan/podlators/lib/Pod/Text/Overstrike.pm
@@ -26,7 +26,7 @@ use warnings;
use Pod::Text ();
our @ISA = qw(Pod::Text);
-our $VERSION = '5.00';
+our $VERSION = '5.01';
##############################################################################
# Overrides
diff --git a/cpan/podlators/lib/Pod/Text/Termcap.pm b/cpan/podlators/lib/Pod/Text/Termcap.pm
index 1a13a8e1b6..d4b74874d8 100644
--- a/cpan/podlators/lib/Pod/Text/Termcap.pm
+++ b/cpan/podlators/lib/Pod/Text/Termcap.pm
@@ -21,7 +21,7 @@ use POSIX ();
use Term::Cap;
our @ISA = qw(Pod::Text);
-our $VERSION = '5.00';
+our $VERSION = '5.01';
##############################################################################
# Overrides
diff --git a/cpan/podlators/scripts/pod2man.PL b/cpan/podlators/scripts/pod2man.PL
index 5b89980c75..ba3de2398f 100644
--- a/cpan/podlators/scripts/pod2man.PL
+++ b/cpan/podlators/scripts/pod2man.PL
@@ -139,7 +139,7 @@ pod2man - Convert POD data to formatted *roff input
pod2man [B<--center>=I<string>] [B<--date>=I<string>]
[B<--encoding>=I<encoding>] [B<--errors>=I<style>] [B<--fixed>=I<font>]
[B<--fixedbold>=I<font>] [B<--fixeditalic>=I<font>]
- [B<--fixedbolditalic>=I<font>] [B<--guesswork>=I<rule>[,I<rule>...]
+ [B<--fixedbolditalic>=I<font>] [B<--guesswork>=I<rule>[,I<rule>...]]
[B<--name>=I<name>] [B<--nourls>] [B<--official>]
[B<--release>=I<version>] [B<--section>=I<manext>]
[B<--quotes>=I<quotes>] [B<--lquote>=I<quote>] [B<--rquote>=I<quote>]
diff --git a/cpan/podlators/scripts/pod2text.PL b/cpan/podlators/scripts/pod2text.PL
index 073f0725eb..50088bfad3 100644
--- a/cpan/podlators/scripts/pod2text.PL
+++ b/cpan/podlators/scripts/pod2text.PL
@@ -82,9 +82,9 @@ my $stdin;
my %options;
Getopt::Long::config ('bundling');
GetOptions (\%options, 'alt|a', 'code', 'color|c', 'encoding|e=s', 'errors=s',
- 'help|h', 'indent|i=i', 'loose|l', 'margin|left-margin|m=i',
- 'nourls', 'overstrike|o', 'quotes|q=s', 'sentence|s', 'stderr',
- 'termcap|t', 'utf8|u', 'width|w=i')
+ 'guesswork=s', 'help|h', 'indent|i=i', 'loose|l',
+ 'margin|left-margin|m=i', 'nourls', 'overstrike|o', 'quotes|q=s',
+ 'sentence|s', 'stderr', 'termcap|t', 'utf8|u', 'width|w=i')
or exit 1;
pod2usage (1) if $options{help};
@@ -142,7 +142,8 @@ pod2text - Convert POD data to formatted ASCII text
=head1 SYNOPSIS
pod2text [B<-aclostu>] [B<--code>] S<[B<-e> I<encoding>]>
- [B<--errors>=I<style>] [B<-i> I<indent>] S<[B<-q> I<quotes>]>
+ [B<--errors>=I<style>] [B<--guesswork>=I<rule>[,I<rule>...]]
+ S<[B<-i> I<indent>]> S<[B<-q> I<quotes>]>
[B<--nourls>] [B<--stderr>] S<[B<-w> I<width>]> [I<input> [I<output> ...]]
pod2text B<-h>
@@ -217,6 +218,34 @@ errors entirely, as much as possible.
The default is C<die>.
+=item B<--guesswork>=I<rule>[,I<rule>...]
+
+[5.01] By default, B<pod2text> applies some default formatting rules based on
+guesswork and regular expressions that are intended to make writing Perl
+documentation easier and require less explicit markup. These rules may not
+always be appropriate, particularly for documentation that isn't about Perl.
+This option allows turning all or some of it off.
+
+The special rule C<all> enables all guesswork. This is also the default for
+backward compatibility reasons. The special rule C<none> disables all
+guesswork. Otherwise, the value of this option should be a comma-separated
+list of one or more of the following keywords:
+
+=over 4
+
+=item quoting
+
+If no guesswork is enabled, any text enclosed in CZ<><> is surrounded by
+double quotes in nroff (terminal) output unless the contents are already
+quoted. When this guesswork is enabled, quote marks will also be suppressed
+for Perl variables, function names, function calls, numbers, and hex
+constants.
+
+=back
+
+Any unknown guesswork name is silently ignored (for potential future
+compatibility), so be careful about spelling.
+
=item B<-i> I<indent>, B<--indent=>I<indent>
[1.00] Set the number of spaces to indent regular text, and the default
diff --git a/cpan/podlators/t/data/basic.cap b/cpan/podlators/t/data/basic.cap
index 3d1451de19..02d8b223ba 100644
--- a/cpan/podlators/t/data/basic.cap
+++ b/cpan/podlators/t/data/basic.cap
@@ -160,7 +160,7 @@
FORMATTING CODES
Another test taken from Pod::Parser.
- This is a test to see if I can do not only $self and "method()", but also
+ This is a test to see if I can do not only $self and method(), but also
"$self->method()" and "$self->{FIELDNAME}" and "$Foo <=> $Bar" without
resorting to escape sequences. If I want to refer to the right-shift
operator I can do something like "$x >> 3" or even "$y >> 5".
diff --git a/cpan/podlators/t/data/basic.clr b/cpan/podlators/t/data/basic.clr
index db17142eb3..c87f4bd712 100644
--- a/cpan/podlators/t/data/basic.clr
+++ b/cpan/podlators/t/data/basic.clr
@@ -160,11 +160,10 @@
FORMATTING CODES
Another test taken from Pod::Parser.
- This is a test to see if I can do not only $self and "method()", but
- also "$self->method()" and "$self->{FIELDNAME}" and "$Foo <=> $Bar"
- without resorting to escape sequences. If I want to refer to the
- right-shift operator I can do something like "$x >> 3" or even "$y >>
- 5".
+ This is a test to see if I can do not only $self and method(), but also
+ "$self->method()" and "$self->{FIELDNAME}" and "$Foo <=> $Bar" without
+ resorting to escape sequences. If I want to refer to the right-shift
+ operator I can do something like "$x >> 3" or even "$y >> 5".
Now for the grand finale of "$self->method()->{FIELDNAME} = {FOO=>BAR}".
And I also want to make sure that newlines work like this
diff --git a/cpan/podlators/t/data/basic.man b/cpan/podlators/t/data/basic.man
index f65b9b5f9d..bbfffc00c6 100644
--- a/cpan/podlators/t/data/basic.man
+++ b/cpan/podlators/t/data/basic.man
@@ -1,11 +1,11 @@
-.SH "NAME"
+.SH NAME
basic.pod \- Test of various basic POD features in translators.
-.SH "HEADINGS"
+.SH HEADINGS
.IX Header "HEADINGS"
Try a few different levels of headings, with embedded formatting codes and
other interesting bits.
.ie n .SH "This ""is"" a ""level 1"" heading"
-.el .SH "This \f(CWis\fP a ``level 1'' heading"
+.el .SH "This \f(CWis\fP a ""level 1"" heading"
.IX Header "This is a ""level 1"" heading"
.SS "``Level'' ""2 \fIheading\fP"
.IX Subsection "``Level'' ""2 heading"
@@ -17,7 +17,7 @@ Level "4 \f(CW\*(C`heading\*(C'\fR
.PP
Now try again with \fBintermixed\fR \fItext\fR.
.ie n .SH "This ""is"" a ""level 1"" heading"
-.el .SH "This \f(CWis\fP a ``level 1'' heading"
+.el .SH "This \f(CWis\fP a ""level 1"" heading"
.IX Header "This is a ""level 1"" heading"
Text.
.SS "``Level'' 2 \fIheading\fP"
@@ -33,7 +33,7 @@ Level "4 \f(CW\*(C`heading\*(C'\fR
.IX Subsection "Level ""4 heading"
.PP
Text.
-.SH "LINKS"
+.SH LINKS
.IX Header "LINKS"
These are all taken from the Pod::Parser tests.
.PP
@@ -101,31 +101,31 @@ There should be whitespace now before this line.
.PP
Taken from Pod::Parser tests, this is a test to ensure the nested =item
paragraphs get indented appropriately.
-.IP "1." 2
+.IP 1. 2
First section.
.RS 2
-.IP "a" 2
+.IP a 2
.IX Item "a"
this is item a
-.IP "b" 2
+.IP b 2
.IX Item "b"
this is item b
.RE
.RS 2
.RE
-.IP "2." 2
+.IP 2. 2
Second section.
.RS 2
-.IP "a" 2
+.IP a 2
.IX Item "a"
this is item a
-.IP "b" 2
+.IP b 2
.IX Item "b"
this is item b
-.IP "c" 2
+.IP c 2
.IX Item "c"
.PD 0
-.IP "d" 2
+.IP d 2
.IX Item "d"
.PD
This is item c & d.
@@ -135,14 +135,13 @@ This is item c & d.
.PP
Now some additional weirdness of our own. Make sure that multiple tags
for one paragraph are properly compacted.
-.ie n .IP """foo""" 4
-.el .IP "``foo''" 4
+.IP """foo""" 4
.IX Item """foo"""
.PD 0
-.IP "\fBbar\fR" 4
+.IP \fBbar\fR 4
.IX Item "bar"
.ie n .IP """baz""" 4
-.el .IP "\f(CWbaz\fR" 4
+.el .IP \f(CWbaz\fR 4
.IX Item "baz"
.PD
There shouldn't be any spaces between any of these item tags; this idiom
@@ -174,9 +173,9 @@ This paragraph should be doubly indented.
.RS 4
.Sp
This paragraph should only be singly indented.
-.IP "\(bu" 4
+.IP \(bu 4
This is an item in the middle of a block-quote, which should be allowed.
-.IP "\(bu" 4
+.IP \(bu 4
We're also testing tagless item commands.
.RE
.RS 4
@@ -187,16 +186,16 @@ Should be back to the single level of indentation.
Should be back to regular indentation.
.PP
Now also check the transformation of * into real bullets for man pages.
-.IP "\(bu" 4
+.IP \(bu 4
An item. We're also testing using =over without a number, and making sure
that item text wraps properly.
-.IP "\(bu" 4
+.IP \(bu 4
Another item.
.PP
and now test the numbering of item blocks.
-.IP "1." 4
+.IP 1. 4
First item.
-.IP "2." 4
+.IP 2. 4
Second item.
.SH "FORMATTING CODES"
.IX Header "FORMATTING CODES"
@@ -236,17 +235,17 @@ The following tests are added to those:
Make sure that a few other odd \fIthings\fR still work. This should be
a vertical bar: |. Here's a test of a few more special escapes
that have to be supported:
-.IP "&" 3
+.IP & 3
An ampersand.
-.IP "'" 3
+.IP ' 3
An apostrophe.
-.IP "<" 3
+.IP < 3
A less-than sign.
-.IP ">" 3
+.IP > 3
A greater-than sign.
.IP """" 3
A double quotation mark.
-.IP "/" 3
+.IP / 3
A forward slash.
.PP
Try to get this bit of text over towards the edge so |that\ all\ of\ this\ text\ inside\ S<>\ won't| be wrapped. Also test the
@@ -256,7 +255,7 @@ There is a soft hy\%phen in hyphen at hy-phen.
.PP
This is a test of an index entry.
.IX Xref "index entry"
-.SH "VERBATIM"
+.SH VERBATIM
.IX Header "VERBATIM"
Throw in a few verbatim paragraphs.
.PP
@@ -314,7 +313,7 @@ up.)
\& visually inspect the nroff output when run on the generated *roff
\& text, unfortunately.)
.Ve
-.SH "CONCLUSION"
+.SH CONCLUSION
.IX Header "CONCLUSION"
That's all, folks!
.SH "COPYRIGHT AND LICENSE"
diff --git a/cpan/podlators/t/data/basic.ovr b/cpan/podlators/t/data/basic.ovr
index c55ab07815..4a2c4cc5f9 100644
--- a/cpan/podlators/t/data/basic.ovr
+++ b/cpan/podlators/t/data/basic.ovr
@@ -160,11 +160,10 @@ OOVVEERR  AANNDD  IITTEEMMSS
FFOORRMMAATTTTIINNGG  CCOODDEESS
Another test taken from Pod::Parser.
- This is a test to see if I can do not only $self and "method()", but
- also "$self->method()" and "$self->{FIELDNAME}" and "$Foo <=> $Bar"
- without resorting to escape sequences. If I want to refer to the
- right-shift operator I can do something like "$x >> 3" or even "$y >>
- 5".
+ This is a test to see if I can do not only $self and method(), but also
+ "$self->method()" and "$self->{FIELDNAME}" and "$Foo <=> $Bar" without
+ resorting to escape sequences. If I want to refer to the right-shift
+ operator I can do something like "$x >> 3" or even "$y >> 5".
Now for the grand finale of "$self->method()->{FIELDNAME} = {FOO=>BAR}".
And I also want to make sure that newlines work like this
diff --git a/cpan/podlators/t/data/basic.txt b/cpan/podlators/t/data/basic.txt
index 6228b24ddf..a8c1fb2205 100644
--- a/cpan/podlators/t/data/basic.txt
+++ b/cpan/podlators/t/data/basic.txt
@@ -160,11 +160,10 @@ OVER AND ITEMS
FORMATTING CODES
Another test taken from Pod::Parser.
- This is a test to see if I can do not only $self and "method()", but
- also "$self->method()" and "$self->{FIELDNAME}" and "$Foo <=> $Bar"
- without resorting to escape sequences. If I want to refer to the
- right-shift operator I can do something like "$x >> 3" or even "$y >>
- 5".
+ This is a test to see if I can do not only $self and method(), but also
+ "$self->method()" and "$self->{FIELDNAME}" and "$Foo <=> $Bar" without
+ resorting to escape sequences. If I want to refer to the right-shift
+ operator I can do something like "$x >> 3" or even "$y >> 5".
Now for the grand finale of "$self->method()->{FIELDNAME} = {FOO=>BAR}".
And I also want to make sure that newlines work like this
diff --git a/cpan/podlators/t/data/man/encoding.groff b/cpan/podlators/t/data/man/encoding.groff
index 1eba828104..649ffdd03e 100644
--- a/cpan/podlators/t/data/man/encoding.groff
+++ b/cpan/podlators/t/data/man/encoding.groff
@@ -53,7 +53,7 @@
.\" ========================================================================
.\"
.IX Title "ENCODING 1"
-.TH ENCODING 1 "2022-09-25" "testing" "podlators"
+.TH ENCODING 1 2022-09-25 testing podlators
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -75,7 +75,7 @@ SMP plane character: \[u1F600]
Non-breaking space: foo\ bar, foo\ bar
.PP
Soft hyphen: fac\%tory
-.SH "LICENSE"
+.SH LICENSE
.IX Header "LICENSE"
Copyright 2022 Russ Allbery <rra@cpan.org>
.PP
diff --git a/cpan/podlators/t/data/man/encoding.roff b/cpan/podlators/t/data/man/encoding.roff
index 7b4e6621a8..68152431ef 100644
--- a/cpan/podlators/t/data/man/encoding.roff
+++ b/cpan/podlators/t/data/man/encoding.roff
@@ -115,7 +115,7 @@
.\" ========================================================================
.\"
.IX Title "ENCODING 1"
-.TH ENCODING 1 "2022-09-25" "testing" "podlators"
+.TH ENCODING 1 2022-09-25 testing podlators
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -137,7 +137,7 @@ SMP plane character: X
Non-breaking space: foo\ bar, foo\ bar
.PP
Soft hyphen: fac\%tory
-.SH "LICENSE"
+.SH LICENSE
.IX Header "LICENSE"
Copyright 2022 Russ Allbery <rra@cpan.org>
.PP
diff --git a/cpan/podlators/t/data/man/encoding.utf8 b/cpan/podlators/t/data/man/encoding.utf8
index b74c2e8804..077028a33f 100644
--- a/cpan/podlators/t/data/man/encoding.utf8
+++ b/cpan/podlators/t/data/man/encoding.utf8
@@ -54,7 +54,7 @@
.\" ========================================================================
.\"
.IX Title "ENCODING 1"
-.TH ENCODING 1 "2022-09-25" "testing" "podlators"
+.TH ENCODING 1 2022-09-25 testing podlators
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -76,7 +76,7 @@ SMP plane character: 😀
Non-breaking space: foo\ bar, foo\ bar
.PP
Soft hyphen: fac\%tory
-.SH "LICENSE"
+.SH LICENSE
.IX Header "LICENSE"
Copyright 2022 Russ Allbery <rra@cpan.org>
.PP
diff --git a/cpan/podlators/t/data/perl.conf b/cpan/podlators/t/data/perl.conf
index 7fc4db8673..4f70cad4f8 100644
--- a/cpan/podlators/t/data/perl.conf
+++ b/cpan/podlators/t/data/perl.conf
@@ -1,5 +1,18 @@
# Configuration for Perl tests. -*- perl -*-
+# Not all of the modules have been converted to my current coding standard
+# yet.
+@CRITIC_IGNORE = qw(
+ blib/lib/Pod/Man.pm
+ blib/lib/Pod/ParseLink.pm
+ blib/lib/Pod/Text.pm
+ blib/lib/Pod/Text/Color.pm
+ blib/lib/Pod/Text/Overstrike.pm
+ blib/lib/Pod/Text/Termcap.pm
+ blib/script/pod2man
+ blib/script/pod2text
+);
+
# Default minimum version requirement.
$MINIMUM_VERSION = '5.010';
diff --git a/cpan/podlators/t/data/perlcriticrc b/cpan/podlators/t/data/perlcriticrc
new file mode 100644
index 0000000000..46436834c3
--- /dev/null
+++ b/cpan/podlators/t/data/perlcriticrc
@@ -0,0 +1,125 @@
+# -*- conf -*-
+#
+# Default configuration for perlcritic. Be sure to copy this into the source
+# for packages that run perlcritic tests automatically during the build for
+# reproducible test results.
+#
+# This file has been updated to match perlcritic 1.134.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2018-2022 Russ Allbery <eagle@eyrie.org>
+# Copyright 2011-2013
+# The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+# SPDX-License-Identifier: MIT
+
+severity = 1
+verbose = %f:%l:%c: [%p] %m (%e, Severity: %s)\n
+
+# I prefer this policy (a lot, actually), but other people in my group at
+# Stanford really didn't like it, so this is my compromise to agree with a
+# group coding style.
+[-CodeLayout::ProhibitParensWithBuiltins]
+
+# This conflicts with Subroutines::ProhibitExplicitReturnUndef and
+# Subroutines::RequireFinalReturn, and I prefer the brevity of the simple
+# return statement. I don't think the empty list versus undef behavior is
+# that confusing.
+#
+# This should be Community::EmptyReturn, which is the new name of the module,
+# but currently ignores have to use the Freenode::EmptyReturn name instead.
+[-Community::EmptyReturn]
+[-Freenode::EmptyReturn]
+
+# This recommends using given/when, but Perl has marked those as experimental
+# and cautions against using when.
+[-ControlStructures::ProhibitCascadingIfElse]
+
+# Stanford's coding style allows postfix unless for flow control. There
+# doesn't appear to be any way to allow it only for flow control (the logic
+# for "if" and "when" appears to be special-cased), so we have to allow unless
+# globally.
+[ControlStructures::ProhibitPostfixControls]
+allow = unless
+
+# This is handled with a separate test case that uses Test::Spelling.
+[-Documentation::PodSpelling]
+
+# The POD sections Perl::Critic wants are incompatible with the POD template
+# from perlpodstyle, which is what I use for my POD documentation.
+[-Documentation::RequirePodSections]
+
+# This problem was fixed in Perl 5.14, which now properly preserves the value
+# of $@ even if destructors run at exit from the eval block.
+[-ErrorHandling::RequireCheckingReturnValueOfEval]
+
+# The default of 9 is too small and forces weird code contortions. After some
+# experimentation, I've never found this helpful in driving useful refactors.
+[-InputOutput::RequireBriefOpen]
+
+# This is correct 80% of the time, but it isn't correct for a lot of scripts
+# inside packages, where maintaining $VERSION isn't worth the effort.
+# Unfortunately, there's no way to override it, so it gets turned off
+# globally.
+[-Modules::RequireVersionVar]
+
+# This sounds interesting but is actually useless. Any large blocks of
+# literal text, which does not add to the complexity of the regex, will set it
+# off.
+[-RegularExpressions::ProhibitComplexRegexes]
+
+# Produces false positives currently with postfix dereferencing (introduced in
+# Perl 5.20). See https://github.com/Perl-Critic/Perl-Critic/issues/578.
+[-References::ProhibitDoubleSigils]
+
+# Five arguments to a method has seemed reasonable at least once: a pair of
+# input file data and path, a pair of output file descriptor and path, and
+# a dict of additional arguments.
+[Subroutines::ProhibitManyArgs]
+skip_object = 1
+
+# I generally don't want to require Readonly as a prerequisite for all my Perl
+# modules.
+[-ValuesAndExpressions::ProhibitConstantPragma]
+
+# A good idea, but there are too many places where this would be more
+# confusing than helpful. Pull out numbers if one might change them
+# independent of the algorithm, but don't do so for mathematical formulae.
+[-ValuesAndExpressions::ProhibitMagicNumbers]
+
+# This has never triggered on anything useful and keeps telling me to add
+# underscores to UNIX timestamps and port numbers, which is just silly.
+[-ValuesAndExpressions::RequireNumberSeparators]
+
+# IO::Uncompress::Gunzip puts the error message in a package variable.
+# Text::Wrap has a broken interface that requires use of package variables.
+# YAML::XS also cannot be configured without package variables.
+[Variables::ProhibitPackageVars]
+add_packages = IO::Uncompress::Gunzip Text::Wrap YAML::XS
+
+# use English was one of the worst ideas in the history of Perl. It makes the
+# code slightly more readable for amateurs at the cost of confusing
+# experienced Perl programmers and sending people in futile quests for where
+# these magical global variables are defined.
+[-Variables::ProhibitPunctuationVars]
diff --git a/cpan/podlators/t/data/perltidyrc b/cpan/podlators/t/data/perltidyrc
new file mode 100644
index 0000000000..dc3a2f74fe
--- /dev/null
+++ b/cpan/podlators/t/data/perltidyrc
@@ -0,0 +1,30 @@
+# -*- conf -*-
+#
+# Default options for perltidy for proper Perl code reformatting.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2021-2022 Russ Allbery <eagle@eyrie.org>
+# Copyright 2012-2013
+# The Board of Trustees of the Leland Stanford Junior University
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice and
+# this notice are preserved. This file is offered as-is, without any
+# warranty.
+#
+# SPDX-License-Identifier: FSFAP
+
+-bbao # put line breaks before any operator
+-nbbc # don't force blank lines before comments (bad for else blocks)
+-boc # do not re-break lists, since perltidy is awful at this
+-ce # cuddle braces around else
+-l=79 # usually use 78, but don't want 79-long lines reformatted
+-nlop # disable vertical alignment of logical and ternary expressions
+-pt=2 # don't add extra whitespace around parentheses
+-sbt=2 # ...or square brackets
+-nsfs # no space before semicolon in for (not that I use this form)
+-nvc # disable vertical alignment of = and similar symbols
+-xci # improve indentation of nested structures
diff --git a/cpan/podlators/t/data/snippets/man/agrave b/cpan/podlators/t/data/snippets/man/agrave
index 134087ff21..1f1f0db5e6 100644
--- a/cpan/podlators/t/data/snippets/man/agrave
+++ b/cpan/podlators/t/data/snippets/man/agrave
@@ -10,6 +10,6 @@ encoding roff
Open E<agrave> la shell. Previous versions mapped it wrong.
[output]
-.SH "agrave"
+.SH agrave
.IX Header "agrave"
Open a\*` la shell. Previous versions mapped it wrong.
diff --git a/cpan/podlators/t/data/snippets/man/bullet-after-nonbullet b/cpan/podlators/t/data/snippets/man/bullet-after-nonbullet
index f98302add6..31baf55324 100644
--- a/cpan/podlators/t/data/snippets/man/bullet-after-nonbullet
+++ b/cpan/podlators/t/data/snippets/man/bullet-after-nonbullet
@@ -18,8 +18,8 @@ Also not a bullet.
=back
[output]
-.IP "foo" 4
+.IP foo 4
.IX Item "foo"
Not a bullet.
-.IP "*" 4
+.IP * 4
Also not a bullet.
diff --git a/cpan/podlators/t/data/snippets/man/bullets b/cpan/podlators/t/data/snippets/man/bullets
index 8cab7e9e52..3d280d5d9d 100644
--- a/cpan/podlators/t/data/snippets/man/bullets
+++ b/cpan/podlators/t/data/snippets/man/bullets
@@ -17,9 +17,9 @@ Another bullet.
=back
[output]
-.IP "\(bu" 4
+.IP \(bu 4
A bullet.
-.IP "\(bu" 4
+.IP \(bu 4
Another bullet.
-.IP "\(bu" 4
+.IP \(bu 4
Also a bullet.
diff --git a/cpan/podlators/t/data/snippets/man/c-in-name b/cpan/podlators/t/data/snippets/man/c-in-name
index e17952d0d5..f8f93fc22d 100644
--- a/cpan/podlators/t/data/snippets/man/c-in-name
+++ b/cpan/podlators/t/data/snippets/man/c-in-name
@@ -7,5 +7,5 @@ C<> in NAME
test - C<test>
[output]
-.SH "NAME"
+.SH NAME
test \- "test"
diff --git a/cpan/podlators/t/data/snippets/man/cpp b/cpan/podlators/t/data/snippets/man/cpp
index 8b3e7f9454..c21515cc72 100644
--- a/cpan/podlators/t/data/snippets/man/cpp
+++ b/cpan/podlators/t/data/snippets/man/cpp
@@ -13,7 +13,7 @@ Other mentions of C++.
=cut
[output]
-.SH "NAME"
+.SH NAME
gcc \- GNU project C and C++ compiler
.SH "C++ NOTES"
.IX Header "C++ NOTES"
diff --git a/cpan/podlators/t/data/snippets/man/error-die b/cpan/podlators/t/data/snippets/man/error-die
index 48b9cac795..9458d07f71 100644
--- a/cpan/podlators/t/data/snippets/man/error-die
+++ b/cpan/podlators/t/data/snippets/man/error-die
@@ -14,10 +14,10 @@ Bar.
=head1 NEXT
[output]
-.IP "Foo" 4
+.IP Foo 4
.IX Item "Foo"
Bar.
-.SH "NEXT"
+.SH NEXT
.IX Header "NEXT"
[errors]
diff --git a/cpan/podlators/t/data/snippets/man/error-none b/cpan/podlators/t/data/snippets/man/error-none
index 0636c3c476..f760e023d9 100644
--- a/cpan/podlators/t/data/snippets/man/error-none
+++ b/cpan/podlators/t/data/snippets/man/error-none
@@ -16,8 +16,8 @@ Bar.
=head1 NEXT
[output]
-.IP "Foo" 4
+.IP Foo 4
.IX Item "Foo"
Bar.
-.SH "NEXT"
+.SH NEXT
.IX Header "NEXT"
diff --git a/cpan/podlators/t/data/snippets/man/error-normal b/cpan/podlators/t/data/snippets/man/error-normal
index cdd5d40e00..364fc55ceb 100644
--- a/cpan/podlators/t/data/snippets/man/error-normal
+++ b/cpan/podlators/t/data/snippets/man/error-normal
@@ -11,10 +11,10 @@ Bar.
=head1 NEXT
[output]
-.IP "Foo" 4
+.IP Foo 4
.IX Item "Foo"
Bar.
-.SH "NEXT"
+.SH NEXT
.IX Header "NEXT"
.SH "POD ERRORS"
.IX Header "POD ERRORS"
diff --git a/cpan/podlators/t/data/snippets/man/error-pod b/cpan/podlators/t/data/snippets/man/error-pod
index 44056539a4..d8c8f028b7 100644
--- a/cpan/podlators/t/data/snippets/man/error-pod
+++ b/cpan/podlators/t/data/snippets/man/error-pod
@@ -14,10 +14,10 @@ Bar.
=head1 NEXT
[output]
-.IP "Foo" 4
+.IP Foo 4
.IX Item "Foo"
Bar.
-.SH "NEXT"
+.SH NEXT
.IX Header "NEXT"
.SH "POD ERRORS"
.IX Header "POD ERRORS"
diff --git a/cpan/podlators/t/data/snippets/man/error-stderr b/cpan/podlators/t/data/snippets/man/error-stderr
index 9effc9eef9..7d163a6ded 100644
--- a/cpan/podlators/t/data/snippets/man/error-stderr
+++ b/cpan/podlators/t/data/snippets/man/error-stderr
@@ -14,10 +14,10 @@ Bar.
=head1 NEXT
[output]
-.IP "Foo" 4
+.IP Foo 4
.IX Item "Foo"
Bar.
-.SH "NEXT"
+.SH NEXT
.IX Header "NEXT"
[errors]
diff --git a/cpan/podlators/t/data/snippets/man/error-stderr-opt b/cpan/podlators/t/data/snippets/man/error-stderr-opt
index e4e0cf8e19..549adee483 100644
--- a/cpan/podlators/t/data/snippets/man/error-stderr-opt
+++ b/cpan/podlators/t/data/snippets/man/error-stderr-opt
@@ -14,10 +14,10 @@ Bar.
=head1 NEXT
[output]
-.IP "Foo" 4
+.IP Foo 4
.IX Item "Foo"
Bar.
-.SH "NEXT"
+.SH NEXT
.IX Header "NEXT"
[errors]
diff --git a/cpan/podlators/t/data/snippets/man/fixed-font-in-item b/cpan/podlators/t/data/snippets/man/fixed-font-in-item
index 55e52353df..523ac7326a 100644
--- a/cpan/podlators/t/data/snippets/man/fixed-font-in-item
+++ b/cpan/podlators/t/data/snippets/man/fixed-font-in-item
@@ -20,10 +20,10 @@ didn't properly stop italic.
.IX Header "Fixed-width Fonts in =item"
In podlators 4.06 and earlier, italic was terminated with \ef(CW, which
didn't properly stop italic.
-.ie n .IP """tar \f(CIoption\fR... [\f(CIname\fR]...""" 2
+.ie n .IP """tar \fIoption\fR... [\fIname\fR]...""" 2
.el .IP "\f(CWtar \fR\f(CIoption\fR\f(CW... [\fR\f(CIname\fR\f(CW]...\fR" 2
.IX Item "tar option... [name]..."
.PD 0
-.ie n .IP """tar \f(CIletter\fR... [\f(CIargument\fR]... [\f(CIoption\fR]... [\f(CIname\fR]...""" 2
+.ie n .IP """tar \fIletter\fR... [\fIargument\fR]... [\fIoption\fR]... [\fIname\fR]...""" 2
.el .IP "\f(CWtar \fR\f(CIletter\fR\f(CW... [\fR\f(CIargument\fR\f(CW]... [\fR\f(CIoption\fR\f(CW]... [\fR\f(CIname\fR\f(CW]...\fR" 2
.IX Item "tar letter... [argument]... [option]... [name]..."
diff --git a/cpan/podlators/t/data/snippets/man/guesswork b/cpan/podlators/t/data/snippets/man/guesswork
index 11d5b72184..ff9a46248c 100644
--- a/cpan/podlators/t/data/snippets/man/guesswork
+++ b/cpan/podlators/t/data/snippets/man/guesswork
@@ -13,7 +13,7 @@ Manpage: foo(1), Pod::Man(3perl), git-rebase(1)
Variables: $foo, @bar::baz, %Pod::Blah
[output]
-.SH "GUESSWORK"
+.SH GUESSWORK
.IX Header "GUESSWORK"
The hyphens-in-compound-words shouldn't be escaped, but e\-mail should be.
.PP
diff --git a/cpan/podlators/t/data/snippets/man/guesswork-all b/cpan/podlators/t/data/snippets/man/guesswork-all
index 789dbd96a6..536d5ae3e7 100644
--- a/cpan/podlators/t/data/snippets/man/guesswork-all
+++ b/cpan/podlators/t/data/snippets/man/guesswork-all
@@ -16,7 +16,7 @@ Manpage: foo(1), Pod::Man(3perl), git-rebase(1)
Variables: $foo, @bar::baz, %Pod::Blah
[output]
-.SH "GUESSWORK"
+.SH GUESSWORK
.IX Header "GUESSWORK"
The hyphens-in-compound-words shouldn't be escaped, but e\-mail should be.
.PP
diff --git a/cpan/podlators/t/data/snippets/man/guesswork-no-quoting b/cpan/podlators/t/data/snippets/man/guesswork-no-quoting
index c3793e3086..71954f456a 100644
--- a/cpan/podlators/t/data/snippets/man/guesswork-no-quoting
+++ b/cpan/podlators/t/data/snippets/man/guesswork-no-quoting
@@ -31,7 +31,7 @@ C<5e-7>,
C<0xdeadbeef>
[output]
-.SH "QUOTING"
+.SH QUOTING
.IX Header "QUOTING"
Suppress quotes:
\&\f(CW"foo"\fR,
diff --git a/cpan/podlators/t/data/snippets/man/guesswork-none b/cpan/podlators/t/data/snippets/man/guesswork-none
index ff615e5680..5187606087 100644
--- a/cpan/podlators/t/data/snippets/man/guesswork-none
+++ b/cpan/podlators/t/data/snippets/man/guesswork-none
@@ -16,7 +16,7 @@ Manpage: foo(1), Pod::Man(3perl), git-rebase(1)
Variables: $foo, @bar::baz, %Pod::Blah
[output]
-.SH "GUESSWORK"
+.SH GUESSWORK
.IX Header "GUESSWORK"
The hyphens-in-compound-words shouldn't be escaped, but e\-mail should be.
.PP
diff --git a/cpan/podlators/t/data/snippets/man/guesswork-partial b/cpan/podlators/t/data/snippets/man/guesswork-partial
index 19a8cb6b8b..b90e1b9da2 100644
--- a/cpan/podlators/t/data/snippets/man/guesswork-partial
+++ b/cpan/podlators/t/data/snippets/man/guesswork-partial
@@ -16,7 +16,7 @@ Manpage: foo(1), Pod::Man(3perl), git-rebase(1)
Variables: $foo, @bar::baz, %Pod::Blah
[output]
-.SH "GUESSWORK"
+.SH GUESSWORK
.IX Header "GUESSWORK"
The hyphens-in-compound-words shouldn't be escaped, but e\-mail should be.
.PP
diff --git a/cpan/podlators/t/data/snippets/man/guesswork-quoting b/cpan/podlators/t/data/snippets/man/guesswork-quoting
index d452fe388b..dcd0a7bb44 100644
--- a/cpan/podlators/t/data/snippets/man/guesswork-quoting
+++ b/cpan/podlators/t/data/snippets/man/guesswork-quoting
@@ -28,7 +28,7 @@ C<5e-7>,
C<0xdeadbeef>
[output]
-.SH "QUOTING"
+.SH QUOTING
.IX Header "QUOTING"
Suppress quotes:
\&\f(CW"foo"\fR,
diff --git a/cpan/podlators/t/data/snippets/man/iso-8859-1 b/cpan/podlators/t/data/snippets/man/iso-8859-1
index d2816cdeb0..4454d09ca6 100644
--- a/cpan/podlators/t/data/snippets/man/iso-8859-1
+++ b/cpan/podlators/t/data/snippets/man/iso-8859-1
@@ -18,7 +18,7 @@ Beyoncé! Beyoncé! Beyoncé!!
Older versions didn't convert Beyoncé in verbatim.
[output]
-.SH "ACCENTS"
+.SH ACCENTS
.IX Header "ACCENTS"
Beyoncé! Beyoncé! Beyoncé!!
.PP
diff --git a/cpan/podlators/t/data/snippets/man/iso-8859-1-error-die b/cpan/podlators/t/data/snippets/man/iso-8859-1-error-die
index b89abaf936..e7761d3d7e 100644
--- a/cpan/podlators/t/data/snippets/man/iso-8859-1-error-die
+++ b/cpan/podlators/t/data/snippets/man/iso-8859-1-error-die
@@ -16,7 +16,7 @@ error.
☺
[output]
-.SH "INVALID"
+.SH INVALID
.IX Header "INVALID"
This character cannot be represented in ISO\-8859\-1, so should produce an
error.
diff --git a/cpan/podlators/t/data/snippets/man/iso-8859-1-error-pod b/cpan/podlators/t/data/snippets/man/iso-8859-1-error-pod
index 29950e09c7..304e0c8545 100644
--- a/cpan/podlators/t/data/snippets/man/iso-8859-1-error-pod
+++ b/cpan/podlators/t/data/snippets/man/iso-8859-1-error-pod
@@ -15,7 +15,7 @@ error.
☺
[output]
-.SH "INVALID"
+.SH INVALID
.IX Header "INVALID"
This character cannot be represented in ISO\-8859\-1, so should produce an
error.
diff --git a/cpan/podlators/t/data/snippets/man/iso-8859-1-roff b/cpan/podlators/t/data/snippets/man/iso-8859-1-roff
index 8dd2acba5c..c029481138 100644
--- a/cpan/podlators/t/data/snippets/man/iso-8859-1-roff
+++ b/cpan/podlators/t/data/snippets/man/iso-8859-1-roff
@@ -18,7 +18,7 @@ Beyoncé! Beyoncé! Beyoncé!!
Older versions didn't convert Beyoncé in verbatim.
[output]
-.SH "ACCENTS"
+.SH ACCENTS
.IX Header "ACCENTS"
Beyonce\*'! Beyonce\*'! Beyonce\*'!!
.PP
diff --git a/cpan/podlators/t/data/snippets/man/language b/cpan/podlators/t/data/snippets/man/language
index 3d39941c51..03342a9b4e 100644
--- a/cpan/podlators/t/data/snippets/man/language
+++ b/cpan/podlators/t/data/snippets/man/language
@@ -14,6 +14,6 @@ Perl 自身㯠Unicode ã§å‹•ä½œã—ã¾ã™ã€‚Perl スクリプト内ã®æ–‡å­—列ã
[output]
.mso ja.tmac
.hla ja
-.SH "JAPANESE"
+.SH JAPANESE
.IX Header "JAPANESE"
Perl 自身㯠Unicode ã§å‹•ä½œã—ã¾ã™ã€‚Perl スクリプト内ã®æ–‡å­—列リテラルや正è¦è¡¨ç¾ã¯ Unicode ã‚’å‰æã¨ã—ã¦ã„ã¾ã™ã€‚ãã—ã¦å…¥å‡ºåŠ›ã®ãŸã‚ã«ã¯ã€ã“ã‚Œã¾ã§ä½¿ã‚ã‚Œã¦ããŸã•ã¾ã–ã¾ãªæ–‡å­—コードã«å¯¾å¿œã™ã‚‹ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã€ã€Œ Encode ã€ãŒæ¨™æº–装備ã•ã‚Œã¦ãŠã‚Šã€Unicode ã¨ã“れらã®æ–‡å­—コードã®ç›¸äº’変æ›ã‚‚ç°¡å˜ã«è¡Œãˆã‚‹ã‚ˆã†ã«ãªã£ã¦ã„ã¾ã™ã€‚
diff --git a/cpan/podlators/t/data/snippets/man/long-quote b/cpan/podlators/t/data/snippets/man/long-quote
index 589dcb99ea..e324ee5d5e 100644
--- a/cpan/podlators/t/data/snippets/man/long-quote
+++ b/cpan/podlators/t/data/snippets/man/long-quote
@@ -2,7 +2,7 @@
Long quotes option
[options]
-quotes \(lq"\(rq"
+quotes "\(lq\(rq"
[input]
=head1 FOO C<BAR> BAZ
@@ -10,7 +10,7 @@ quotes \(lq"\(rq"
Foo C<bar> baz.
[output]
-.ie n .SH "FOO \(lq""BAR\(rq"" BAZ"
+.ie n .SH "FOO ""\(lqBAR\(rq"" BAZ"
.el .SH "FOO \f(CWBAR\fP BAZ"
.IX Header "FOO BAR BAZ"
Foo \f(CW\*(C`bar\*(C'\fR baz.
diff --git a/cpan/podlators/t/data/snippets/man/markup-in-name b/cpan/podlators/t/data/snippets/man/markup-in-name
index de27acddf1..2408c437a4 100644
--- a/cpan/podlators/t/data/snippets/man/markup-in-name
+++ b/cpan/podlators/t/data/snippets/man/markup-in-name
@@ -7,5 +7,5 @@ Various markup in NAME
test - B<test> I<italics> F<file>
[output]
-.SH "NAME"
+.SH NAME
test \- test italics file
diff --git a/cpan/podlators/t/data/snippets/man/name-guesswork b/cpan/podlators/t/data/snippets/man/name-guesswork
index 7626aeff2d..547545d573 100644
--- a/cpan/podlators/t/data/snippets/man/name-guesswork
+++ b/cpan/podlators/t/data/snippets/man/name-guesswork
@@ -11,8 +11,8 @@ function() - man(1) $variable
function() - man(1) $variable
[output]
-.SH "NAME"
+.SH NAME
function() \- man(1) $variable
-.SS "THINGS"
+.SS THINGS
.IX Subsection "THINGS"
\&\fBfunction()\fR \- \fBman\fR\|(1) \f(CW$variable\fR
diff --git a/cpan/podlators/t/data/snippets/man/name-quotes b/cpan/podlators/t/data/snippets/man/name-quotes
index 0b547f82b4..7bdc06d59b 100644
--- a/cpan/podlators/t/data/snippets/man/name-quotes
+++ b/cpan/podlators/t/data/snippets/man/name-quotes
@@ -11,5 +11,5 @@ rquote '
C</etc/blah> - config file for I<blah(1)>
[output]
-.SH "NAME"
+.SH NAME
\&'/etc/blah' \- config file for blah(1)
diff --git a/cpan/podlators/t/data/snippets/man/name-quotes-none b/cpan/podlators/t/data/snippets/man/name-quotes-none
index 3e362f0b0c..87e184aee7 100644
--- a/cpan/podlators/t/data/snippets/man/name-quotes-none
+++ b/cpan/podlators/t/data/snippets/man/name-quotes-none
@@ -10,5 +10,5 @@ quotes none
C</etc/blah> - config file for I<blah(1)>
[output]
-.SH "NAME"
+.SH NAME
/etc/blah \- config file for blah(1)
diff --git a/cpan/podlators/t/data/snippets/man/nested-lists b/cpan/podlators/t/data/snippets/man/nested-lists
index 45d4a58095..769dc95e8f 100644
--- a/cpan/podlators/t/data/snippets/man/nested-lists
+++ b/cpan/podlators/t/data/snippets/man/nested-lists
@@ -23,7 +23,7 @@ Should be a bullet.
.IX Item "First level"
Blah blah blah....
.RS 4
-.IP "\(bu" 4
+.IP \(bu 4
Should be a bullet.
.RE
.RS 4
diff --git a/cpan/podlators/t/data/snippets/man/non-ascii b/cpan/podlators/t/data/snippets/man/non-ascii
index f45d2cc793..9e9fdccaf6 100644
--- a/cpan/podlators/t/data/snippets/man/non-ascii
+++ b/cpan/podlators/t/data/snippets/man/non-ascii
@@ -10,6 +10,6 @@ encoding roff
It cost me E<165>12345! That should be an X.
[output]
-.SH "YEN"
+.SH YEN
.IX Header "YEN"
It cost me X12345! That should be an X.
diff --git a/cpan/podlators/t/data/snippets/man/nonbreaking-space-l b/cpan/podlators/t/data/snippets/man/nonbreaking-space-l
index 8908df347c..2f48619c0e 100644
--- a/cpan/podlators/t/data/snippets/man/nonbreaking-space-l
+++ b/cpan/podlators/t/data/snippets/man/nonbreaking-space-l
@@ -15,7 +15,7 @@ S<L<RFC3110|https://tools.ietf.org/html/rfc3110>>
S<L<RFC4034|https://tools.ietf.org/html/rfc4034>>
[output]
-.SH "URLS"
+.SH URLS
.IX Header "URLS"
S<> wrapping L<> should make the space between the anchor and URL
non-breaking and thus keep them together.
diff --git a/cpan/podlators/t/data/snippets/man/not-bullet b/cpan/podlators/t/data/snippets/man/not-bullet
index 8b468f0f02..dfa2ea742d 100644
--- a/cpan/podlators/t/data/snippets/man/not-bullet
+++ b/cpan/podlators/t/data/snippets/man/not-bullet
@@ -11,5 +11,5 @@ Not bullet.
=back
[output]
-.IP "*" 4
+.IP * 4
Not bullet.
diff --git a/cpan/podlators/t/data/snippets/man/periods b/cpan/podlators/t/data/snippets/man/periods
index afdea425d2..bc841db41a 100644
--- a/cpan/podlators/t/data/snippets/man/periods
+++ b/cpan/podlators/t/data/snippets/man/periods
@@ -7,6 +7,6 @@ Quoted periods
This C<.> should be quoted.
[output]
-.SH "PERIODS"
+.SH PERIODS
.IX Header "PERIODS"
This \f(CW\*(C`.\*(C'\fR should be quoted.
diff --git a/cpan/podlators/t/data/snippets/man/utf8-verbatim b/cpan/podlators/t/data/snippets/man/utf8-verbatim
index 0eea4ccb53..50447c4832 100644
--- a/cpan/podlators/t/data/snippets/man/utf8-verbatim
+++ b/cpan/podlators/t/data/snippets/man/utf8-verbatim
@@ -18,7 +18,7 @@ Beyoncé! Beyoncé! Beyoncé!!
Older versions did not convert Beyoncé in verbatim.
[output]
-.SH "BEYONCÉ"
+.SH BEYONCÉ
.IX Header "BEYONCÉ"
Beyoncé! Beyoncé! Beyoncé!!
.PP
diff --git a/cpan/podlators/t/data/snippets/man/x-whitespace-entry b/cpan/podlators/t/data/snippets/man/x-whitespace-entry
index 8ec01ace0b..52732ee352 100644
--- a/cpan/podlators/t/data/snippets/man/x-whitespace-entry
+++ b/cpan/podlators/t/data/snippets/man/x-whitespace-entry
@@ -7,7 +7,7 @@ X<> matching whitespace
Index entry matching a whitespace escape.X<\n>
[output]
-.SH "INDEX"
+.SH INDEX
.IX Header "INDEX"
Index entry matching a whitespace escape.
.IX Xref "\\n"
diff --git a/cpan/podlators/t/data/snippets/text/guesswork-no-quoting b/cpan/podlators/t/data/snippets/text/guesswork-no-quoting
new file mode 100644
index 0000000000..17009359d9
--- /dev/null
+++ b/cpan/podlators/t/data/snippets/text/guesswork-no-quoting
@@ -0,0 +1,39 @@
+[name]
+Disable quoting guesswork
+
+[options]
+guesswork none
+
+[input]
+=head1 QUOTING
+
+Suppress quotes:
+C<"foo">,
+C<'foo'>,
+C<`foo`>,
+C<`foo'>
+
+All these should now be quoted:
+C<$#f>,
+C<$foo[4]>,
+C<$foo{bar}>,
+C<%foo>,
+C<@foo>,
+C<&foo>,
+C<*foo>,
+C<< $foo->("bar") >>,
+C<&foo::baz("bar")>,
+C<&foo()>,
+C<foo( "bar" )>,
+C<-1000>,
+C<132.123>,
+C<5e-7>,
+C<0xdeadbeef>
+
+[output]
+QUOTING
+ Suppress quotes: "foo", 'foo', `foo`, `foo'
+
+ All these should now be quoted: "$#f", "$foo[4]", "$foo{bar}", "%foo",
+ "@foo", "&foo", "*foo", "$foo->("bar")", "&foo::baz("bar")", "&foo()",
+ "foo( "bar" )", "-1000", "132.123", "5e-7", "0xdeadbeef"
diff --git a/cpan/podlators/t/data/snippets/text/guesswork-quoting b/cpan/podlators/t/data/snippets/text/guesswork-quoting
new file mode 100644
index 0000000000..78a9756fb2
--- /dev/null
+++ b/cpan/podlators/t/data/snippets/text/guesswork-quoting
@@ -0,0 +1,34 @@
+[name]
+Quoting guesswork applied by default
+
+[input]
+=head1 QUOTING
+
+Suppress quotes:
+C<"foo">,
+C<'foo'>,
+C<`foo`>,
+C<`foo'>,
+C<$^F>,
+C<$">,
+C<$#f>,
+C<$foo[4]>,
+C<$foo{bar}>,
+C<%foo>,
+C<@foo>,
+C<&foo>,
+C<*foo>,
+C<< $foo->("bar") >>,
+C<&foo::baz("bar")>,
+C<&foo()>,
+C<foo( "bar" )>,
+C<-1000>,
+C<132.123>,
+C<5e-7>,
+C<0xdeadbeef>
+
+[output]
+QUOTING
+ Suppress quotes: "foo", 'foo', `foo`, `foo', $^F, $", $#f, $foo[4],
+ $foo{bar}, %foo, @foo, &foo, *foo, $foo->("bar"), &foo::baz("bar"),
+ &foo(), foo( "bar" ), -1000, 132.123, 5e-7, 0xdeadbeef
diff --git a/cpan/podlators/t/general/filehandle.t b/cpan/podlators/t/general/filehandle.t
index 3c5d753a48..7cd766acbc 100644
--- a/cpan/podlators/t/general/filehandle.t
+++ b/cpan/podlators/t/general/filehandle.t
@@ -38,7 +38,7 @@ if (!-d $tmpdir) {
}
# Load the tests.
-my $man_data_ref = read_snippet('man/cpp');
+my $man_data_ref = read_snippet('man/cpp');
my $text_data_ref = read_snippet('text/cpp');
# Write the POD source to a temporary file for the input file handle.
@@ -50,11 +50,11 @@ close($input) or BAIL_OUT("cannot write to $infile: $!");
# Write the Pod::Man output to a file.
my $outfile = File::Spec->catfile('t', 'tmp', "tmp$$.man");
-open($input, '<', $infile) or BAIL_OUT("cannot open $infile: $!");
+open($input, '<', $infile) or BAIL_OUT("cannot open $infile: $!");
open(my $output, '>', $outfile) or BAIL_OUT("cannot open $outfile: $!");
my $parser = Pod::Man->new;
$parser->parse_from_filehandle($input, $output);
-close($input) or BAIL_OUT("cannot read from $infile: $!");
+close($input) or BAIL_OUT("cannot read from $infile: $!");
close($output) or BAIL_OUT("cannot write to $outfile: $!");
# Read the output back in and compare it.
@@ -66,11 +66,11 @@ unlink($outfile);
# Now, do the same drill with Pod::Text. Parse the input to a temporary file.
$outfile = File::Spec->catfile('t', 'tmp', "tmp$$.txt");
-open($input, '<', $infile) or BAIL_OUT("cannot open $infile: $!");
+open($input, '<', $infile) or BAIL_OUT("cannot open $infile: $!");
open($output, '>', $outfile) or BAIL_OUT("cannot open $outfile: $!");
$parser = Pod::Text->new;
$parser->parse_from_filehandle($input, $output);
-close($input) or BAIL_OUT("cannot read from $infile: $!");
+close($input) or BAIL_OUT("cannot read from $infile: $!");
close($output) or BAIL_OUT("cannot write to $outfile: $!");
# Read the output back in and compare it. Pod::Text adds a trailing blank
diff --git a/cpan/podlators/t/general/pod-parser.t b/cpan/podlators/t/general/pod-parser.t
index c008499298..e5f398fb59 100644
--- a/cpan/podlators/t/general/pod-parser.t
+++ b/cpan/podlators/t/general/pod-parser.t
@@ -71,8 +71,8 @@ close($input) or BAIL_OUT("cannot write to $infile: $!");
# Now test the pod2text function with a single output. This will send the
# results to standard output, so we need to redirect that to a file.
-open($output, '>', $outfile) or BAIL_OUT("cannot open $outfile: $!");
-open(my $save_stdout, '>&', STDOUT) or BAIL_OUT("cannot dup stdout: $!");
+open($output, '>', $outfile) or BAIL_OUT("cannot open $outfile: $!");
+open(my $save_stdout, '>&', STDOUT) or BAIL_OUT("cannot dup stdout: $!");
open(STDOUT, '>&', $output) or BAIL_OUT("cannot redirect stdout: $!");
pod2text($infile);
close($output) or BAIL_OUT("cannot write to $outfile: $!");
diff --git a/cpan/podlators/t/lib/Test/Podlators.pm b/cpan/podlators/t/lib/Test/Podlators.pm
index fa4a8bf931..5efacba832 100644
--- a/cpan/podlators/t/lib/Test/Podlators.pm
+++ b/cpan/podlators/t/lib/Test/Podlators.pm
@@ -8,7 +8,8 @@
package Test::Podlators;
-use 5.008;
+use 5.010;
+use base qw(Exporter);
use strict;
use warnings;
@@ -17,22 +18,12 @@ use Exporter;
use File::Spec;
use Test::More;
-# For Perl 5.006 compatibility.
-## no critic (ClassHierarchies::ProhibitExplicitISA)
+our $VERSION = '2.01';
-# Declare variables that should be set in BEGIN for robustness.
-our (@EXPORT_OK, @ISA, $VERSION);
-
-# Set $VERSION and everything export-related in a BEGIN block for robustness
-# against circular module loading (not that we load any modules, but
-# consistency is good).
-BEGIN {
- @ISA = qw(Exporter);
- $VERSION = '2.01';
- @EXPORT_OK = qw(
- read_snippet read_test_data slurp test_snippet test_snippet_with_io
- );
-}
+# Export the test helper functions.
+our @EXPORT_OK = qw(
+ read_snippet read_test_data slurp test_snippet test_snippet_with_io
+);
# The file handle used to capture STDERR while we mess with file descriptors.
my $OLD_STDERR;
@@ -45,7 +36,7 @@ my $SAVED_STDERR;
# scripts trying to create the temporary directory when running tests in
# parallel.
sub _stderr_cleanup {
- if ($SAVED_STDERR && -f $SAVED_STDERR) {
+ if ($SAVED_STDERR && -e $SAVED_STDERR) {
unlink($SAVED_STDERR);
}
return;
@@ -64,12 +55,8 @@ sub _stderr_save {
mkdir($tmpdir, 0777) or BAIL_OUT("cannot create $tmpdir: $!");
}
my $path = File::Spec->catfile($tmpdir, "out$$.err");
-
- ## no critic(InputOutput::RequireBriefOpen)
open($OLD_STDERR, '>&', STDERR) or BAIL_OUT("cannot dup STDERR: $!");
open(STDERR, '>', $path) or BAIL_OUT("cannot redirect STDERR: $!");
- ## use critic
-
$SAVED_STDERR = $path;
return;
}
@@ -88,7 +75,7 @@ sub _stderr_restore {
}
# Read one test snippet from the provided relative file name and return it.
-# For the format, see t/data/snippets/README.
+# For the format, see t/data/snippets/README.md.
#
# $path - Relative path to read test data from
#
@@ -249,13 +236,10 @@ sub slurp {
sub test_snippet {
my ($class, $snippet, $options_ref) = @_;
my $data_ref = read_snippet($snippet);
+ $options_ref //= {};
# Determine the encoding to expect for the output portion of the snippet.
- my $encoding;
- if (defined($options_ref)) {
- $encoding = $options_ref->{encoding};
- }
- $encoding ||= 'UTF-8';
+ my $encoding = $options_ref->{encoding} // 'UTF-8';
# Create the formatter object.
my $parser = $class->new(%{ $data_ref->{options} }, name => 'TEST');
@@ -268,7 +252,7 @@ sub test_snippet {
$parser->output_string(\$got);
eval { $parser->parse_string_document($data_ref->{input}) };
my $exception = $@;
- my $stderr = _stderr_restore();
+ my $stderr = _stderr_restore();
# If we were testing Pod::Man, strip off everything prior to .nh from the
# output so that we aren't testing the generated header.
@@ -293,6 +277,45 @@ sub test_snippet {
return;
}
+# Helper function to check the preamble of Pod::Man output.
+#
+# $name - Name of the test
+# $fh - File handle with results
+# $encoding - Expected encoding
+#
+# Returns: True if the preamble contains accent definitions
+sub _check_man_preamble {
+ my ($name, $fh, $encoding) = @_;
+ $encoding = lc($encoding);
+
+ # Check the encoding line.
+ my $line = <$fh>;
+ if ($encoding eq 'ascii') {
+ unlike(
+ $line, qr{ mode: [ ] troff }xms,
+ "$name: no preconv coding line",
+ );
+ } else {
+ is(
+ $line,
+ ".\\\" -*- mode: troff; coding: $encoding -*-\n",
+ "$name: preconv coding line",
+ );
+ }
+
+ # Consume the rest of the preamble and check for accent definitions.
+ my $saw_accents;
+ while (defined($line = <$fh>)) {
+ $line = decode($encoding, $line);
+ if ($line =~ m{ Accent [ ] mark [ ] definitions }xms) {
+ $saw_accents = 1;
+ }
+ last if $line =~ m{ \A [.]nh }xms;
+ }
+
+ return $saw_accents;
+}
+
# Test a formatter with I/O streams on a particular POD snippet. This does
# all the work of loading the snippet, creating the formatter, running it, and
# checking the results, and reports those results with Test::More. It's
@@ -308,21 +331,14 @@ sub test_snippet {
# output - Expect the output to be in this non-standard encoding
sub test_snippet_with_io {
my ($class, $snippet, $options_ref) = @_;
+ $options_ref //= {};
my $data_ref = read_snippet($snippet);
# Determine the encoding to expect for the output portion of the snippet.
- my $encoding;
- if (defined($options_ref)) {
- $encoding = $options_ref->{encoding};
- }
- $encoding ||= 'UTF-8';
+ my $encoding = $options_ref->{encoding} // 'UTF-8';
# Determine the encoding to expect for the actual output.
- my $outencoding;
- if (defined($options_ref)) {
- $outencoding = $options_ref->{output};
- }
- $outencoding ||= 'UTF-8';
+ my $outencoding = $options_ref->{output} // 'UTF-8';
# Additional test output based on whether we're using PerlIO.
my $perlio = q{};
@@ -372,29 +388,10 @@ sub test_snippet_with_io {
# output.
open(my $results, '<', $output_file)
or BAIL_OUT("cannot open $output_file: $!");
- my ($line, $saw_accents);
+ my $saw_accents;
if ($class eq 'Pod::Man') {
- $line = <$results>;
- my $coding = lc($outencoding);
- if ($outencoding eq 'ascii') {
- unlike(
- $line, qr{ mode: [ ] troff }xms,
- "$data_ref->{name}: no preconv coding line$perlio"
- );
- } else {
- is(
- $line,
- qq{.\\\" -*- mode: troff; coding: $coding -*-\n},
- "$data_ref->{name}: preconv coding line$perlio"
- );
- }
- while (defined($line = <$results>)) {
- $line = decode($outencoding, $line);
- if ($line =~ m{ Accent [ ] mark [ ] definitions }xms) {
- $saw_accents = 1;
- }
- last if $line =~ m{ \A [.]nh }xms;
- }
+ my $name = $data_ref->{name};
+ $saw_accents = _check_man_preamble($name, $results, $outencoding);
}
my $saw = do { local $/ = undef; <$results> };
$saw = decode($outencoding, $saw);
@@ -409,13 +406,13 @@ sub test_snippet_with_io {
is(
$saw_accents,
($data_ref->{options}{encoding} || q{}) eq 'roff' ? 1 : undef,
- "$data_ref->{name}: accent definitions$perlio"
+ "$data_ref->{name}: accent definitions$perlio",
);
}
is(
$saw,
decode($encoding, $data_ref->{output}),
- "$data_ref->{name}: output$perlio"
+ "$data_ref->{name}: output$perlio",
);
return;
}
diff --git a/cpan/podlators/t/man/devise-date.t b/cpan/podlators/t/man/devise-date.t
index 4729e0bf0f..f211dcc945 100644
--- a/cpan/podlators/t/man/devise-date.t
+++ b/cpan/podlators/t/man/devise-date.t
@@ -5,7 +5,7 @@
# that it's identical. It also tests special handling of the POD_MAN_DATE
# and SOURCE_DATE_EPOCH environment variables.
#
-# Copyright 2009, 2014-2015, 2018-2019 Russ Allbery <rra@cpan.org>
+# Copyright 2009, 2014-2015, 2018-2019, 2022 Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
@@ -22,8 +22,8 @@ use POSIX qw(strftime);
use Test::More tests => 6;
# Start with environment variables affecting the date stripped.
-local $ENV{SOURCE_DATE_EPOCH};
-local $ENV{POD_MAN_DATE};
+local $ENV{SOURCE_DATE_EPOCH} = undef;
+local $ENV{POD_MAN_DATE} = undef;
# Check that the results of device_date matches strftime. There is no input
# file name, so this will use the current time.
@@ -31,7 +31,7 @@ my $parser = Pod::Man->new;
is(
$parser->devise_date,
strftime('%Y-%m-%d', gmtime()),
- 'devise_date matches strftime'
+ 'devise_date matches strftime',
);
# Set the override environment variable and ensure that it's honored.
@@ -43,21 +43,23 @@ local $ENV{POD_MAN_DATE} = q{};
is($parser->devise_date, q{}, 'devise_date honors empty POD_MAN_DATE');
# Set another environment variable and ensure that it's honored.
-local $ENV{POD_MAN_DATE};
+local $ENV{POD_MAN_DATE} = undef;
local $ENV{SOURCE_DATE_EPOCH} = 1439390140;
is($parser->devise_date, '2015-08-12', 'devise_date honors SOURCE_DATE_EPOCH');
# Check that POD_MAN_DATE overrides SOURCE_DATE_EPOCH
-local $ENV{POD_MAN_DATE} = '2013-01-01';
+local $ENV{POD_MAN_DATE} = '2013-01-01';
local $ENV{SOURCE_DATE_EPOCH} = 1482676620;
-is($parser->devise_date, '2013-01-01',
- 'devise_date honors POD_MAN_DATE over SOURCE_DATE_EPOCH');
+is(
+ $parser->devise_date, '2013-01-01',
+ 'devise_date honors POD_MAN_DATE over SOURCE_DATE_EPOCH',
+);
# Check that an invalid SOURCE_DATE_EPOCH is not accepted
-local $ENV{POD_MAN_DATE};
+local $ENV{POD_MAN_DATE} = undef;
local $ENV{SOURCE_DATE_EPOCH} = '1482676620B';
is(
$parser->devise_date,
strftime('%Y-%m-%d', gmtime()),
- 'devise_date ignores invalid SOURCE_DATE_EPOCH'
+ 'devise_date ignores invalid SOURCE_DATE_EPOCH',
);
diff --git a/cpan/podlators/t/man/empty.t b/cpan/podlators/t/man/empty.t
index 9e243afc41..3c6ef23f48 100644
--- a/cpan/podlators/t/man/empty.t
+++ b/cpan/podlators/t/man/empty.t
@@ -9,7 +9,7 @@
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-use 5.008;
+use 5.010;
use strict;
use warnings;
@@ -32,8 +32,10 @@ local $SIG{__WARN__} = sub { croak($_[0]) };
# Try a POD document where the only command is invalid. Make sure it succeeds
# and doesn't throw an exception.
my $invalid_char = chr(utf8::unicode_to_native(0xa0));
-ok(eval { $parser->parse_string_document("=$invalid_char") },
- 'Parsed invalid document');
+ok(
+ eval { $parser->parse_string_document("=$invalid_char") },
+ 'Parsed invalid document',
+);
is($@, q{}, '...with no errors');
# With recent Pod::Simple, there will be a POD ERRORS section. With older
@@ -46,7 +48,7 @@ SKIP: {
like(
$output,
qr{ [.]SH [ ] "POD [ ] ERRORS" }xms,
- '...and output contains a POD ERRORS section'
+ '...and output contains a POD ERRORS section',
);
}
@@ -62,6 +64,6 @@ SKIP: {
like(
$output,
qr{ [.]SH [ ] "POD [ ] ERRORS" }xms,
- '...and output contains a POD ERRORS section'
+ '...and output contains a POD ERRORS section',
);
}
diff --git a/cpan/podlators/t/man/heading.t b/cpan/podlators/t/man/heading.t
index f8964025e3..dea3176670 100644
--- a/cpan/podlators/t/man/heading.t
+++ b/cpan/podlators/t/man/heading.t
@@ -2,7 +2,7 @@
#
# Additional tests for Pod::Man heading generation.
#
-# Copyright 2002, 2004, 2006, 2008-2009, 2012, 2015, 2018-2019
+# Copyright 2002, 2004, 2006, 2008-2009, 2012, 2015, 2018-2019, 2022
# Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
@@ -16,7 +16,7 @@ use warnings;
use lib 't/lib';
-use Test::More tests => 9;
+use Test::More tests => 11;
use Test::Podlators qw(read_test_data);
BEGIN {
@@ -25,6 +25,7 @@ BEGIN {
# Loop through all the test data, generate output, and compare it to the
# desired output data.
+my $testnum = 1;
while (defined(my $data = read_test_data(\*DATA, { options => 1 }))) {
my $parser = Pod::Man->new(%{ $data->{options} });
isa_ok($parser, 'Pod::Man', 'Parser object');
@@ -38,7 +39,8 @@ while (defined(my $data = read_test_data(\*DATA, { options => 1 }))) {
my ($heading) = ($got =~ m{^ ([.]TH [^\n]+ \n)}xms);
# Compare the results.
- is($heading, $data->{output});
+ is($heading, $data->{output}, "Test $testnum");
+ $testnum++;
}
# Below the marker are sets of options, the input data, and the corresponding
@@ -55,7 +57,7 @@ release 1.0
test - Test man page
###
-.TH STDIN 1 "2009-01-17" "1.0" "User Contributed Perl Documentation"
+.TH STDIN 1 2009-01-17 1.0 "User Contributed Perl Documentation"
###
###
@@ -68,7 +70,7 @@ release 2.0-beta
test - Test man page
###
-.TH TEST 8 "2009-01-17" "2.0-beta" "User Contributed Perl Documentation"
+.TH TEST 8 2009-01-17 2.0-beta "User Contributed Perl Documentation"
###
###
@@ -80,7 +82,7 @@ center Testing Documentation
test - Test man page
###
-.TH STDIN 1 "2009-01-17" "1.0" "Testing Documentation"
+.TH STDIN 1 2009-01-17 1.0 "Testing Documentation"
###
###
@@ -94,3 +96,17 @@ test - Test man page
###
.TH STDIN 1 "" "" ""
###
+
+###
+date foo ""bar""
+release "quoted"
+section 4"
+name "BAR
+center Something
+###
+=head1 NAME
+
+test - Test man page
+###
+.TH """BAR" "4""" "foo """"bar""""" """quoted""" Something
+###
diff --git a/cpan/podlators/t/man/iso-8859-1.t b/cpan/podlators/t/man/iso-8859-1.t
index 336cd38ad4..1c0c996a32 100644
--- a/cpan/podlators/t/man/iso-8859-1.t
+++ b/cpan/podlators/t/man/iso-8859-1.t
@@ -47,9 +47,9 @@ eval 'binmode($builder->failure_output, ":encoding(iso-8859-1)")';
# Test the snippet with ISO 8859-1 output, with and without PerlIO layers.
test_snippet_with_io(
'Pod::Man', 'man/iso-8859-1',
- { encoding => 'iso-8859-1', output => 'iso-latin-1' }
+ { encoding => 'iso-8859-1', output => 'iso-latin-1' },
);
test_snippet_with_io(
'Pod::Man', 'man/iso-8859-1',
- { encoding => 'iso-8859-1', perlio_iso => 1, output => 'iso-latin-1' }
+ { encoding => 'iso-8859-1', perlio_iso => 1, output => 'iso-latin-1' },
);
diff --git a/cpan/podlators/t/man/no-encode.t b/cpan/podlators/t/man/no-encode.t
index 0a807e2581..108e0b3106 100644
--- a/cpan/podlators/t/man/no-encode.t
+++ b/cpan/podlators/t/man/no-encode.t
@@ -10,10 +10,12 @@
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-use 5.008;
+use 5.010;
use strict;
use warnings;
+use Carp qw(croak);
+
use Test::More tests => 8;
# Remove the record of the Encode module being loaded if it already was (it
@@ -24,7 +26,7 @@ BEGIN {
delete $INC{'Encode.pm'};
my $reject_encode = sub {
if ($_[1] eq 'Encode.pm') {
- die "refusing to load Encode\n";
+ croak('refusing to load Encode');
}
};
unshift(@INC, $reject_encode);
@@ -40,7 +42,7 @@ BEGIN {
# is overridden below when we enable utf8 and do expect a warning.
local $SIG{__WARN__} = sub {
my @warnings = @_;
- die join("\n", "No warnings expected; instead got:", @warnings);
+ croak(join("\n", 'No warnings expected; instead got:', @warnings));
};
# First, check that everything works properly if an encoding of roff is set.
@@ -55,7 +57,7 @@ $parser->parse_string_document($pod);
like(
$output,
qr{ Beyonce\\[*]\' }xms,
- 'Works without Encode for roff encoding'
+ 'Works without Encode for roff encoding',
);
# Likewise for an encoding of groff.
@@ -66,7 +68,7 @@ $parser->parse_string_document($pod);
like(
$output_groff,
qr{ Beyonc\\\[u00E9\] }xms,
- 'Works without Encode for groff encoding'
+ 'Works without Encode for groff encoding',
);
# The default output format is UTF-8, so it should produce an error message
@@ -76,7 +78,7 @@ like(
like(
$_[0],
qr{ falling [ ] back [ ] to [ ] groff [ ] escapes }xms,
- 'Pod::Man warns with no Encode module'
+ 'Pod::Man warns with no Encode module',
);
};
$parser = Pod::Man->new(name => 'test');
@@ -93,7 +95,7 @@ is($output, $output_groff, 'Degraded gracefull to groff output');
like(
$_[0],
qr{ falling [ ] back [ ] to [ ] groff [ ] escapes }xms,
- 'Pod::Man warns with no Encode module'
+ 'Pod::Man warns with no Encode module',
);
};
$parser = Pod::Man->new(name => 'test', encoding => 'iso-8859-1');
@@ -103,5 +105,5 @@ $parser->output_string(\$output);
$parser->parse_string_document($pod);
is(
$output, $output_groff,
- 'Explicit degraded gracefully to groff output'
+ 'Explicit degraded gracefully to groff output',
);
diff --git a/cpan/podlators/t/man/snippets.t b/cpan/podlators/t/man/snippets.t
index 8b7ad2f471..dbdb8a63df 100644
--- a/cpan/podlators/t/man/snippets.t
+++ b/cpan/podlators/t/man/snippets.t
@@ -26,17 +26,17 @@ BEGIN {
# List of snippets run by this test.
my @snippets = qw(
- agrave backslash-man-ref bullet-after-nonbullet bullets c-in-header
- c-in-name dollar-magic error-die error-none error-normal error-pod
- error-stderr error-stderr-opt eth fixed-font fixed-font-in-item for-blocks
- guesswork guesswork-all guesswork-no-quoting guesswork-none
- guesswork-partial guesswork-quoting hyphen-in-s item-fonts language
- link-quoting link-to-url long-quote lquote-and-quote lquote-rquote
- markup-in-name multiline-x naive naive-groff name-guesswork name-quotes
- name-quotes-none nested-lists newlines-in-c non-ascii nonbreaking-space-l
- not-bullet not-numbers nourls periods quote-escaping rquote-none
- soft-hyphens trailing-space true-false x-whitespace x-whitespace-entry
- zero-width-space
+ agrave backslash-man-ref bullet-after-nonbullet bullets c-in-header
+ c-in-name dollar-magic error-die error-none error-normal error-pod
+ error-stderr error-stderr-opt eth fixed-font fixed-font-in-item for-blocks
+ guesswork guesswork-all guesswork-no-quoting guesswork-none
+ guesswork-partial guesswork-quoting hyphen-in-s item-fonts language
+ link-quoting link-to-url long-quote lquote-and-quote lquote-rquote
+ markup-in-name multiline-x naive naive-groff name-guesswork name-quotes
+ name-quotes-none nested-lists newlines-in-c non-ascii nonbreaking-space-l
+ not-bullet not-numbers nourls periods quote-escaping rquote-none
+ soft-hyphens trailing-space true-false x-whitespace x-whitespace-entry
+ zero-width-space
);
# Run all the tests.
diff --git a/cpan/podlators/t/parselink/basic.t b/cpan/podlators/t/parselink/basic.t
index 0f39e56397..7b7edeeeb5 100644
--- a/cpan/podlators/t/parselink/basic.t
+++ b/cpan/podlators/t/parselink/basic.t
@@ -2,7 +2,7 @@
#
# Tests for Pod::ParseLink.
#
-# Copyright 2001, 2009, 2018, 2020 by Russ Allbery <rra@cpan.org>
+# Copyright 2001, 2009, 2018, 2020, 2022 by Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
@@ -21,6 +21,7 @@ BEGIN {
# The format of each entry in this array is the L<> text followed by the
# five-element parse returned by parselink.
+#<<<
our @TESTS = (
['foo' => (undef, 'foo', 'foo', undef, 'pod')],
['foo|bar' => ('foo', 'foo', 'bar', undef, 'pod')],
@@ -28,18 +29,18 @@ our @TESTS = (
['foo/"baz boo"' => (undef, '"baz boo" in foo', 'foo', 'baz boo', 'pod')],
['/bar' => (undef, '"bar"', undef, 'bar', 'pod')],
['/"baz boo"' => (undef, '"baz boo"', undef, 'baz boo', 'pod')],
- ['/baz boo', => (undef, '"baz boo"', undef, 'baz boo', 'pod')],
+ ['/baz boo' => (undef, '"baz boo"', undef, 'baz boo', 'pod')],
[
'foo bar/baz boo' =>
- (undef, '"baz boo" in foo bar', 'foo bar', 'baz boo', 'pod')
+ (undef, '"baz boo" in foo bar', 'foo bar', 'baz boo', 'pod'),
],
[
'foo bar / baz boo' =>
- (undef, '"baz boo" in foo bar', 'foo bar', 'baz boo', 'pod')
+ (undef, '"baz boo" in foo bar', 'foo bar', 'baz boo', 'pod'),
],
[
"foo\nbar\nbaz\n/\nboo" =>
- (undef, '"boo" in foo bar baz', 'foo bar baz', 'boo', 'pod')
+ (undef, '"boo" in foo bar baz', 'foo bar baz', 'boo', 'pod'),
],
['anchor|name/section' => qw(anchor anchor name section pod)],
['"boo var baz"' => (undef, '"boo var baz"', undef, 'boo var baz', 'pod')],
@@ -49,16 +50,16 @@ our @TESTS = (
undef, '"boo bar baz / baz boo"',
undef, 'boo bar baz / baz boo',
'pod',
- )
+ ),
],
['fooZ<>bar' => (undef, 'fooZ<>bar', 'fooZ<>bar', undef, 'pod')],
[
'Testing I<italics>|foo/bar' =>
- ('Testing I<italics>', 'Testing I<italics>', 'foo', 'bar', 'pod')
+ ('Testing I<italics>', 'Testing I<italics>', 'foo', 'bar', 'pod'),
],
[
'foo/I<Italic> text' =>
- (undef, '"I<Italic> text" in foo', 'foo', 'I<Italic> text', 'pod')
+ (undef, '"I<Italic> text" in foo', 'foo', 'I<Italic> text', 'pod'),
],
[
'fooE<verbar>barZ<>/Section C<with> I<B<other> markup' => (
@@ -67,29 +68,29 @@ our @TESTS = (
'fooE<verbar>barZ<>',
'Section C<with> I<B<other> markup',
'pod',
- )
+ ),
],
[
'Nested L<http://www.perl.org/>|fooE<sol>bar' => (
'Nested L<http://www.perl.org/>',
'Nested L<http://www.perl.org/>',
'fooE<sol>bar', undef, 'pod',
- )
+ ),
],
['ls(1)' => (undef, 'ls(1)', 'ls(1)', undef, 'man')],
[
' perlfunc(1)/open ' =>
- (undef, '"open" in perlfunc(1)', 'perlfunc(1)', 'open', 'man')
+ (undef, '"open" in perlfunc(1)', 'perlfunc(1)', 'open', 'man'),
],
[
'some manual page|perl(1)' =>
- ('some manual page', 'some manual page', 'perl(1)', undef, 'man')
+ ('some manual page', 'some manual page', 'perl(1)', undef, 'man'),
],
[
'http://www.perl.org/' => (
undef, 'http://www.perl.org/', 'http://www.perl.org/', undef,
'url',
- )
+ ),
],
[
'news:yld72axzc8.fsf@windlord.stanford.edu' => (
@@ -97,24 +98,25 @@ our @TESTS = (
'news:yld72axzc8.fsf@windlord.stanford.edu',
'news:yld72axzc8.fsf@windlord.stanford.edu',
undef, 'url',
- )
+ ),
],
[
'link|http://www.perl.org/' =>
- ('link', 'link', 'http://www.perl.org/', undef, 'url')
+ ('link', 'link', 'http://www.perl.org/', undef, 'url'),
],
[
'0|http://www.perl.org/' =>
- ('0', '0', 'http://www.perl.org/', undef, 'url')
+ ('0', '0', 'http://www.perl.org/', undef, 'url'),
],
['0|Pod::Parser' => ('0', '0', 'Pod::Parser', undef, 'pod')],
);
+#>>>
# Run all of the tests.
for my $test (@TESTS) {
my ($link, @expected) = @$test;
my @results = parselink($link);
- my $pretty = $link;
+ my $pretty = $link;
$pretty =~ s{\n}{\\n}xmsg;
is_deeply(\@results, \@expected, $pretty);
}
diff --git a/cpan/podlators/t/style/critic.t b/cpan/podlators/t/style/critic.t
new file mode 100644
index 0000000000..71c3db4e56
--- /dev/null
+++ b/cpan/podlators/t/style/critic.t
@@ -0,0 +1,87 @@
+#!/usr/bin/perl
+#
+# Check for perlcritic errors in all code.
+#
+# If author tests are enabled, check all Perl code in blib/lib, examples, usr,
+# t, and Build.PL for problems uncovered by perlcritic, ignoring template
+# files, junk, and any files explicitly configured to be ignored.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2019-2022 Russ Allbery <eagle@eyrie.org>
+# Copyright 2013-2014
+# The Board of Trustees of the Leland Stanford Junior University
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+# SPDX-License-Identifier: MIT
+
+use 5.010;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Test::RRA qw(skip_unless_author use_prereq);
+use Test::RRA::Config qw(@CRITIC_IGNORE);
+
+use Test::More;
+
+# Skip tests unless we're running author tests since this test is too
+# sensitive to the exact version of Perl::Critic to be generally useful.
+skip_unless_author('Coding style tests');
+
+# Load prerequisite modules.
+use_prereq('Perl::Critic::Utils');
+use_prereq('Test::Perl::Critic');
+
+# Force the embedded Perl::Tidy check to use the correct configuration.
+local $ENV{PERLTIDY} = 't/data/perltidyrc';
+
+# Import the configuration file.
+Test::Perl::Critic->import(-profile => 't/data/perlcriticrc');
+
+# By default, Test::Perl::Critic only checks blib. We also want to check t,
+# Build.PL, and examples.
+my @files = Perl::Critic::Utils::all_perl_files('blib');
+if (!@files) {
+ @files = Perl::Critic::Utils::all_perl_files('lib');
+}
+if (-e 'Build.PL') {
+ push(@files, 'Build.PL');
+}
+for my $dir (qw(examples usr t)) {
+ if (-d $dir) {
+ push(@files, Perl::Critic::Utils::all_perl_files($dir));
+ }
+}
+
+# Strip out Autoconf templates or left-over perltidy files.
+@files = grep { !m{ [.](?:in|tdy) }xms } @files;
+
+# Strip out ignored files.
+my %ignore = map { $_ => 1 } @CRITIC_IGNORE;
+@files = grep { !$ignore{$_} } @files;
+
+# Declare a plan now that we know what we're testing.
+plan tests => scalar @files;
+
+# Run the actual tests.
+for my $file (@files) {
+ critic_ok($file);
+}
diff --git a/cpan/podlators/t/style/kwalitee.t b/cpan/podlators/t/style/kwalitee.t
new file mode 100644
index 0000000000..65b6964777
--- /dev/null
+++ b/cpan/podlators/t/style/kwalitee.t
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+#
+# Test Perl code using the Kwalitee metrics from CPANTS.
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2022 Russ Allbery <eagle@eyrie.org>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+# SPDX-License-Identifier: MIT
+
+use 5.010;
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Test::RRA qw(skip_unless_author use_prereq);
+
+use Test::More;
+
+# Skip tests unless we're running author tests.
+skip_unless_author('Distribution style tests');
+
+# Load prerequisite module.
+use_prereq('Test::Kwalitee', 'kwalitee_ok');
+
+# Do the testing. Disable testing for use strict, since that's done as part
+# of a separate test. Disable testing for META.yml if it's not present, since
+# it's generated as part of the distribution process but isn't normally
+# present in a development tree.
+my @options = qw(-use_strict);
+if (!-e 'META.yml') {
+ push(@options, '-has_meta_yml');
+}
+kwalitee_ok(@options);
+done_testing();
diff --git a/cpan/podlators/t/text/invalid.t b/cpan/podlators/t/text/invalid.t
index 0b34221ed5..f6e6c6e4e2 100644
--- a/cpan/podlators/t/text/invalid.t
+++ b/cpan/podlators/t/text/invalid.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Test Pod::Text with a document that produces only errors.
#
@@ -13,7 +13,7 @@
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-use 5.008;
+use 5.010;
use strict;
use warnings;
diff --git a/cpan/podlators/t/text/iso-8859-1.t b/cpan/podlators/t/text/iso-8859-1.t
index b27604a7a9..d48378bad8 100644
--- a/cpan/podlators/t/text/iso-8859-1.t
+++ b/cpan/podlators/t/text/iso-8859-1.t
@@ -46,7 +46,7 @@ eval 'binmode($builder->failure_output, ":encoding(iso-8859-1)")';
# Test the snippet with ISO 8859-1 output with a PerlIO layer.
test_snippet_with_io(
'Pod::Text', 'text/iso-8859-1',
- { encoding => 'iso-8859-1', output => 'iso-8859-1', perlio_iso => 1 }
+ { encoding => 'iso-8859-1', output => 'iso-8859-1', perlio_iso => 1 },
);
# Test the snippet with ISO 8859-1 input but an encoding forcing output to
diff --git a/cpan/podlators/t/text/snippets.t b/cpan/podlators/t/text/snippets.t
index 8fe6d90779..d8eb46a2c9 100644
--- a/cpan/podlators/t/text/snippets.t
+++ b/cpan/podlators/t/text/snippets.t
@@ -16,7 +16,7 @@ use warnings;
use lib 't/lib';
-use Test::More tests => 63;
+use Test::More tests => 67;
use Test::Podlators qw(test_snippet);
# Load the module.
@@ -26,11 +26,12 @@ BEGIN {
# List of snippets run by this test.
my @snippets = qw(
- alt c-with-spaces code cpp empty error-die error-none error-normal error-pod
- error-stderr error-stderr-opt for late-encoding link-rt link-url margin
- naive name-quotes name-quotes-none non-latin nonbreaking-space
- nonbreaking-space-l nourls periods quotes-opt s-whitespace sentence-spacing
- utf8 verbatim
+ alt c-with-spaces code cpp empty error-die error-none error-normal
+ error-pod error-stderr error-stderr-opt for guesswork-quoting
+ guesswork-no-quoting late-encoding link-rt link-url margin naive
+ name-quotes name-quotes-none non-latin nonbreaking-space
+ nonbreaking-space-l nourls periods quotes-opt s-whitespace
+ sentence-spacing utf8 verbatim
);
# Run all the tests.
diff --git a/cpan/podlators/t/text/termcap.t b/cpan/podlators/t/text/termcap.t
index 598e0b5620..33ce757d42 100644
--- a/cpan/podlators/t/text/termcap.t
+++ b/cpan/podlators/t/text/termcap.t
@@ -2,7 +2,7 @@
#
# Test Pod::Text::Termcap behavior with various snippets.
#
-# Copyright 2002, 2004, 2006, 2009, 2012-2014, 2018-2019
+# Copyright 2002, 2004, 2006, 2009, 2012-2014, 2018-2019, 2022
# Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
@@ -25,10 +25,10 @@ BEGIN {
}
# Hard-code a few values to try to get reproducible results.
-$ENV{COLUMNS} = 80;
-$ENV{TERM} = 'xterm';
-$ENV{TERMPATH} = File::Spec->catfile('t', 'data', 'termcap');
-$ENV{TERMCAP} = 'xterm:co=#80:do=^J:md=\E[1m:us=\E[4m:me=\E[m';
+local $ENV{COLUMNS} = 80;
+local $ENV{TERM} = 'xterm';
+local $ENV{TERMPATH} = File::Spec->catfile('t', 'data', 'termcap');
+local $ENV{TERMCAP} = 'xterm:co=#80:do=^J:md=\\E[1m:us=\\E[4m:me=\\E[m';
# Check the regex that matches a single formatting character.
my $parser = Pod::Text::Termcap->new();
@@ -43,13 +43,13 @@ for my $snippet (@snippets) {
}
# Now test with an unknown terminal type.
-$ENV{TERM} = 'unknown';
-$ENV{TERMCAP} = 'unknown:co=#80:do=^J';
+local $ENV{TERM} = 'unknown';
+local $ENV{TERMCAP} = 'unknown:co=#80:do=^J';
test_snippet('Pod::Text::Termcap', 'termcap/term-unknown');
# Test the character regex with a fake terminal type that only provides bold
# and normal, not underline.
-$ENV{TERM} = 'fake-test-terminal';
-$ENV{TERMCAP} = 'fake-test-terminal:md=\E[1m:me=\E[m';
+local $ENV{TERM} = 'fake-test-terminal';
+local $ENV{TERMCAP} = 'fake-test-terminal:md=\\E[1m:me=\\E[m';
$parser = Pod::Text::Termcap->new();
is($parser->format_regex(), "\\\e\\[1m|\\\e\\[m", 'Limited character regex');
diff --git a/cpan/podlators/t/text/utf8-io.t b/cpan/podlators/t/text/utf8-io.t
index 44fb0afd43..ff5dde57ba 100644
--- a/cpan/podlators/t/text/utf8-io.t
+++ b/cpan/podlators/t/text/utf8-io.t
@@ -42,7 +42,11 @@ for my $snippet (qw(late-encoding s-whitespace utf8)) {
}
# Load a snippet in ISO 8859-1 that forces the output to be in UTF-8.
-test_snippet_with_io('Pod::Text', 'text/utf8-iso',
- { encoding => 'iso-8859-1' });
-test_snippet_with_io('Pod::Text', 'text/utf8-iso',
- { encoding => 'iso-8859-1', perlio_utf8 => 1, output => 'utf-8' });
+test_snippet_with_io(
+ 'Pod::Text', 'text/utf8-iso',
+ { encoding => 'iso-8859-1' },
+);
+test_snippet_with_io(
+ 'Pod::Text', 'text/utf8-iso',
+ { encoding => 'iso-8859-1', perlio_utf8 => 1, output => 'utf-8' },
+);