summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/pp.c b/pp.c
index 202cac6c1c..79b73e45a1 100644
--- a/pp.c
+++ b/pp.c
@@ -7253,6 +7253,60 @@ PP(pp_unweaken)
RETURN;
}
+PP(pp_blessed)
+{
+ dSP;
+ dTARGET;
+ SV *arg = POPs;
+ SV *rv;
+
+ SvGETMAGIC(arg);
+
+ if(SvROK(arg) && SvOBJECT((rv = SvRV(arg)))) {
+ sv_ref(TARG, rv, TRUE);
+ SvSETMAGIC(TARG);
+ }
+ else
+ sv_setsv(TARG, &PL_sv_undef);
+
+ PUSHs(TARG);
+ RETURN;
+}
+
+PP(pp_refaddr)
+{
+ dSP;
+ dTARGET;
+ SV *arg = POPs;
+
+ SvGETMAGIC(arg);
+
+ if(SvROK(arg))
+ sv_setuv_mg(TARG, PTR2UV(SvRV(arg)));
+ else
+ sv_setsv(TARG, &PL_sv_undef);
+
+ PUSHs(TARG);
+ RETURN;
+}
+
+PP(pp_reftype)
+{
+ dSP;
+ dTARGET;
+ SV *arg = POPs;
+
+ SvGETMAGIC(arg);
+
+ if(SvROK(arg))
+ sv_setpv_mg(TARG, sv_reftype(SvRV(arg), FALSE));
+ else
+ sv_setsv(TARG, &PL_sv_undef);
+
+ PUSHs(TARG);
+ RETURN;
+}
+
/*
* ex: set ts=8 sts=4 sw=4 et:
*/