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