summaryrefslogtreecommitdiff
path: root/pod/perlreapi.pod
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avar@cpan.org>2007-06-18 03:33:34 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-06-18 07:39:35 +0000
commitf7e711955148e1ce710988aa3010c41ca8085a03 (patch)
treedf8b9e38f7bb7a6516c2fe1e64f21ee460b24037 /pod/perlreapi.pod
parent225593e1515f97126032fb4da0b1aafeb00e8e99 (diff)
downloadperl-f7e711955148e1ce710988aa3010c41ca8085a03.tar.gz
SvRX() and SvRXOK() macros
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com> Message-ID: <51dd1af80706172033h1908aa0ge15698204e0b79ed@mail.gmail.com> p4raw-id: //depot/perl@31409
Diffstat (limited to 'pod/perlreapi.pod')
-rw-r--r--pod/perlreapi.pod18
1 files changed, 4 insertions, 14 deletions
diff --git a/pod/perlreapi.pod b/pod/perlreapi.pod
index 2ac4c164b5..c218c102ee 100644
--- a/pod/perlreapi.pod
+++ b/pod/perlreapi.pod
@@ -378,23 +378,13 @@ package as a normal object.
my $re = qr//;
$re->meth; # dispatched to re::engine::Example::meth()
-To retrieve the C<REGEXP> object from the scalar in an XS function use the
-following snippet:
+To retrieve the C<REGEXP> object from the scalar in an XS function use
+the C<SvRX> macro, see L<"REGEXP Functions" in perlapi|perlapi/REGEXP
+Functions>.
void meth(SV * rv)
PPCODE:
- MAGIC * mg;
- REGEXP * re;
-
- if (SvMAGICAL(sv))
- mg_get(sv);
- if (SvROK(sv) &&
- (sv = (SV*)SvRV(sv)) && /* assignment deliberate */
- SvTYPE(sv) == SVt_PVMG &&
- (mg = mg_find(sv, PERL_MAGIC_qr))) /* assignment deliberate */
- {
- re = (REGEXP *)mg->mg_obj;
- }
+ REGEXP * re = SvRX(sv);
=head2 dupe