summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-03-14 20:06:23 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-03-14 20:06:23 +0000
commit44464a025e4f32b72b835ec046467cda7099ad1d (patch)
tree03ce7c165583c942ff112fc0c7d8fbbaec80240a /lib
parent9d2428989d95cd0d9d5fc1f1fcf60ab67cde0b7f (diff)
downloadperl-44464a025e4f32b72b835ec046467cda7099ad1d.tar.gz
protect special characters better against interpretation by *roff
(from Russ Allbery) p4raw-id: //depot/perl@5737
Diffstat (limited to 'lib')
-rw-r--r--lib/Pod/Man.pm10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Pod/Man.pm b/lib/Pod/Man.pm
index 898b5442a1..3ba26a3dc8 100644
--- a/lib/Pod/Man.pm
+++ b/lib/Pod/Man.pm
@@ -264,13 +264,13 @@ $PREAMBLE = <<'----END OF PREAMBLE----';
# Static helper functions
############################################################################
-# Protect leading quotes and periods against interpretation as commands. A
-# leading *roff font escape apparently still leaves a period interpretable
-# as a command by some *roff implementations, so look for a period even
-# after one of those.
+# Protect leading quotes and periods against interpretation as commands.
+# Also protect anything starting with a backslash, since it could expand
+# or hide something that *roff would interpret as a command. This is
+# overkill, but it's much simpler than trying to parse *roff here.
sub protect {
local $_ = shift;
- s{ ^ ( (?: \\f(?:.|\(..) )* [.\'] ) } {\\&$1}xmg;
+ s/^([.\'\\])/\\&$1/mg;
$_;
}