From 32a6f6c4f1672d4c7b3a7008de89b9ed4eb97a04 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 9 Oct 2017 14:45:01 +0200 Subject: [PATCH] Fix DBD parsing slow-up with Perl 5.20 and later --- src/tools/DBD/Parser.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tools/DBD/Parser.pm b/src/tools/DBD/Parser.pm index 901420685..113ef42a8 100644 --- a/src/tools/DBD/Parser.pm +++ b/src/tools/DBD/Parser.pm @@ -78,8 +78,13 @@ sub parseCommon { m/\G \s* /oxgc; # Extract POD - if (m/\G ( = [a-zA-Z] .* ) \n/oxgc) { - $obj->add_pod($1, &parsePod); + if (m/\G ( = [a-zA-Z] )/xgc) { + # The above regex was split from the one below for performance. + # Using m/\G ( = [a-zA-Z] .* ) \n/ is slow in Perl 5.20 and later. + my $directive = $1; + m/\G ( .* ) \n/xgc; + $directive .= $1; + $obj->add_pod($directive, &parsePod); } elsif (m/\G \# /oxgc) { if (m/\G \# ! BEGIN \{ ( [^}]* ) \} ! \# \# \n/oxgc) {