683572
From 1a1d29aaa2e0c668f9a8c960d52b516415f28983 Mon Sep 17 00:00:00 2001
683572
From: Vickenty Fesunov <kent@setattr.net>
683572
Date: Fri, 22 Sep 2017 19:00:46 -0400
683572
Subject: [PATCH] %{^CAPTURE_ALL} was intended to be an alias for %-; make it
683572
 so.
683572
MIME-Version: 1.0
683572
Content-Type: text/plain; charset=UTF-8
683572
Content-Transfer-Encoding: 8bit
683572
683572
For: RT #131867
683572
683572
Add Vickenty Fesunov to AUTHORS.
683572
683572
Signed-off-by: Ported to 5.30 from 1a1d29aaa2e0c668f9a8c960d52b516415f28983.
683572
683572
---
683572
 AUTHORS                                   |  1 +
683572
 ext/Tie-Hash-NamedCapture/NamedCapture.xs |  5 ++++-
683572
 ext/Tie-Hash-NamedCapture/t/tiehash.t     | 11 ++++++++---
683572
683572
diff --git a/AUTHORS b/AUTHORS
683572
index 0091100600..c920d52e96 100644
683572
--- a/AUTHORS
683572
+++ b/AUTHORS
683572
@@ -1265,6 +1265,7 @@ Unicode Consortium		<unicode.org>
683572
 Vadim Konovalov			<vkonovalov@lucent.com>
683572
 Valeriy E. Ushakov		<uwe@ptc.spbu.ru>
683572
 Vernon Lyon			<vlyon@cpan.org>
683572
+Vickenty Fesunov			<kent@setattr.net>
683572
 Victor Adam			<victor@drawall.cc>
683572
 Victor Efimov			<victor@vsespb.ru>
683572
 Viktor Turskyi			<koorchik@gmail.com>
683572
diff --git a/ext/Tie-Hash-NamedCapture/NamedCapture.xs b/ext/Tie-Hash-NamedCapture/NamedCapture.xs
683572
index 7eaae5614d..a607c10090 100644
683572
--- a/ext/Tie-Hash-NamedCapture/NamedCapture.xs
683572
+++ b/ext/Tie-Hash-NamedCapture/NamedCapture.xs
683572
@@ -25,8 +25,11 @@ _tie_it(SV *sv)
683572
     GV * const gv = (GV *)sv;
683572
     HV * const hv = GvHVn(gv);
683572
     SV *rv = newSV_type(SVt_RV);
683572
+    const char *gv_name = GvNAME(gv);
683572
   CODE:
683572
-    SvRV_set(rv, newSVuv(*GvNAME(gv) == '-' ? RXapif_ALL : RXapif_ONE));
683572
+    SvRV_set(rv, newSVuv(
683572
+        strEQ(gv_name, "-") || strEQ(gv_name, "\003APTURE_ALL")
683572
+            ? RXapif_ALL : RXapif_ONE));
683572
     SvROK_on(rv);
683572
     sv_bless(rv, GvSTASH(CvGV(cv)));
683572
 
683572
diff --git a/ext/Tie-Hash-NamedCapture/t/tiehash.t b/ext/Tie-Hash-NamedCapture/t/tiehash.t
683572
index 3ebc81ad68..962754085f 100644
683572
--- a/ext/Tie-Hash-NamedCapture/t/tiehash.t
683572
+++ b/ext/Tie-Hash-NamedCapture/t/tiehash.t
683572
@@ -3,7 +3,12 @@ use strict;
683572
 
683572
 use Test::More;
683572
 
683572
-my %hashes = ('+' => \%+, '-' => \%-);
683572
+my %hashes = (
683572
+    '+' => \%+,
683572
+    '-' => \%-,
683572
+    '{^CAPTURE}' => \%{^CAPTURE},
683572
+    '{^CAPTURE_ALL}' => \%{^CAPTURE_ALL},
683572
+);
683572
 
683572
 foreach (['plus1'],
683572
 	 ['minus1', all => 1],
683572
@@ -20,12 +25,12 @@ foreach (['plus1'],
683572
 is("abcdef" =~ /(?<foo>[ab])*(?<bar>c)(?<foo>d)(?<bar>[ef]*)/, 1,
683572
    "We matched");
683572
 
683572
-foreach my $name (qw(+ plus1 plus2 plus3)) {
683572
+foreach my $name (qw(+ {^CAPTURE} plus1 plus2 plus3)) {
683572
     my $hash = $hashes{$name};
683572
     is_deeply($hash, { foo => 'b', bar => 'c' }, "%$name is as expected");
683572
 }
683572
 
683572
-foreach my $name (qw(- minus1 minus2)) {
683572
+foreach my $name (qw(- {^CAPTURE_ALL} minus1 minus2)) {
683572
     my $hash = $hashes{$name};
683572
     is_deeply($hash, { foo => [qw(b d)], bar => [qw(c ef)] },
683572
 	      "%$name is as expected");
683572
-- 
683572
2.20.1
683572