summaryrefslogtreecommitdiff
path: root/pp.h
diff options
context:
space:
mode:
authorVincent Pit <perl@profvince.com>2008-12-28 11:16:54 +0100
committerVincent Pit <perl@profvince.com>2008-12-28 15:46:41 +0100
commitd30e492cced9a7022652176a253f8f900679d9b0 (patch)
tree0a033351bd5ea72f0b3c4461ca73690fa18da76c /pp.h
parent3f0c5693d0a2100faf1b56983c7325096fcb0bda (diff)
downloadperl-d30e492cced9a7022652176a253f8f900679d9b0.tar.gz
Introduce SvCANEXISTDELETE in pp.h, which simplify the logic in pp_helem and pp_hslice
Diffstat (limited to 'pp.h')
-rw-r--r--pp.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/pp.h b/pp.h
index 6f0f258278..118c027201 100644
--- a/pp.h
+++ b/pp.h
@@ -500,6 +500,15 @@ True if this op will be the return value of an lvalue subroutine
=cut */
#define LVRET ((PL_op->op_private & OPpMAYBE_LVSUB) && is_lvalue_sub())
+#define SvCANEXISTDELETE(sv) \
+ (!SvRMAGICAL(sv) \
+ || ((mg = mg_find((const SV *) sv, PERL_MAGIC_tied)) \
+ && (stash = SvSTASH(SvRV(SvTIED_obj(MUTABLE_SV(sv), mg)))) \
+ && gv_fetchmethod_autoload(stash, "EXISTS", TRUE) \
+ && gv_fetchmethod_autoload(stash, "DELETE", TRUE) \
+ ) \
+ )
+
/*
* Local variables:
* c-indentation-style: bsd