summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-12-15 09:43:41 -0800
committerFather Chrysostomos <sprout@cpan.org>2014-12-15 12:58:00 -0800
commit1f3063473777c9458d9e5c34697672aec5358f41 (patch)
tree54b118d3460648779e2ea5a62437d1c83a38a2f1 /ext
parent54421dd4564d892da2108a290cb0e1a4b525dd27 (diff)
downloadperl-1f3063473777c9458d9e5c34697672aec5358f41.tar.gz
Add B::REGEXP::compflags
Diffstat (limited to 'ext')
-rw-r--r--ext/B/B.pm4
-rw-r--r--ext/B/B.xs6
-rw-r--r--ext/B/t/b.t1
3 files changed, 10 insertions, 1 deletions
diff --git a/ext/B/B.pm b/ext/B/B.pm
index e22d4312c0..e5cc1f0578 100644
--- a/ext/B/B.pm
+++ b/ext/B/B.pm
@@ -873,6 +873,10 @@ in the MAGIC.
=item qr_anoncv
+=item compflags
+
+The last two were added in Perl 5.22.
+
=back
=head2 B::GV Methods
diff --git a/ext/B/B.xs b/ext/B/B.xs
index 8935174455..90bf8d5f60 100644
--- a/ext/B/B.xs
+++ b/ext/B/B.xs
@@ -1715,11 +1715,15 @@ REGEX(sv)
ALIAS:
precomp = 1
qr_anoncv = 2
+ compflags = 3
PPCODE:
if (ix == 1) {
PUSHs(newSVpvn_flags(RX_PRECOMP(sv), RX_PRELEN(sv), SVs_TEMP));
- } else if (ix) {
+ } else if (ix == 2) {
PUSHs(make_sv_object(aTHX_ (SV *)ReANY(sv)->qr_anoncv));
+ } else if (ix) {
+ dXSTARG;
+ PUSHu(RX_COMPFLAGS(sv));
} else {
dXSTARG;
/* FIXME - can we code this method more efficiently? */
diff --git a/ext/B/t/b.t b/ext/B/t/b.t
index abffa3246e..e2d644a093 100644
--- a/ext/B/t/b.t
+++ b/ext/B/t/b.t
@@ -108,6 +108,7 @@ my $obj = B::svref_2object($r);
my $regexp = ($] < 5.011) ? $obj->MAGIC : $obj;
ok($regexp->precomp() eq 'foo', 'Get string from qr//');
like($regexp->REGEX(), qr/\d+/, "REGEX() returns numeric value");
+like($regexp->compflags, qr/^\d+\z/, "compflags returns numeric value");
is B::svref_2object(qr/(?{time})/)->qr_anoncv->ROOT->first->name, 'qr',
'qr_anoncv';
my $iv = 1;