summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-02-02 06:03:04 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-02-02 06:03:04 +0000
commitb62b7eeb9524e037f1672b4b9af0384f4a094694 (patch)
tree3a9ac83f25693a3a7dd57515eba466657efe554c /utils
parent25ea24bb237ad84d30bd8daf86746e45f3449387 (diff)
downloadperl-b62b7eeb9524e037f1672b4b9af0384f4a094694.tar.gz
more meaningful message on invalid pattern argument (from
Kevin Meltzer <KMeltzer@USCO.com>) p4raw-id: //depot/perl@4945
Diffstat (limited to 'utils')
-rw-r--r--utils/perldoc.PL7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils/perldoc.PL b/utils/perldoc.PL
index 5dd0e1b1fb..c4a9113b4a 100644
--- a/utils/perldoc.PL
+++ b/utils/perldoc.PL
@@ -559,6 +559,13 @@ if ($opt_q) {
local @ARGV = @found; # I'm lazy, sue me.
my $found = 0;
my %found_in;
+ my $rx = eval { qr/$opt_q/ };
+ die <<EOD unless $rx;
+Invalid regular expression '$opt_q' given as -q pattern:
+ $@
+Did you mean \\Q$opt_q ?
+
+EOD
while (<>) {
if (/^=head2\s+.*(?:$opt_q)/oi) {