return pp_shmwrite();
}
+PP(pp_dor)
+{
+ return pp_dor();
+}
+
U8 *
Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv)
{
MEMBER_TO_FPTR(Perl_unimplemented_op), /* Perl_pp_threadsv */
MEMBER_TO_FPTR(Perl_pp_setstate),
MEMBER_TO_FPTR(Perl_pp_method_named),
- MEMBER_TO_FPTR(Perl_pp_dor),
+ MEMBER_TO_FPTR(Perl_pp_defined), /* Perl_pp_dor */
MEMBER_TO_FPTR(Perl_pp_dorassign),
}
#endif
fteexec)],
Perl_pp_shmwrite => [qw(shmread msgsnd msgrcv semop)],
Perl_pp_send => ['syswrite'],
+ Perl_pp_defined => ['dor'],
);
while (my ($func, $names) = splice @raw_alias, 0, 2) {
RETURN;
}
-PP(pp_defined)
-{
- dSP;
- register SV* const sv = POPs;
-
- if (!sv || !SvANY(sv))
- RETPUSHNO;
- switch (SvTYPE(sv)) {
- case SVt_PVAV:
- if (AvMAX(sv) >= 0 || SvGMAGICAL(sv)
- || (SvRMAGICAL(sv) && mg_find(sv, PERL_MAGIC_tied)))
- RETPUSHYES;
- break;
- case SVt_PVHV:
- if (HvARRAY(sv) || SvGMAGICAL(sv)
- || (SvRMAGICAL(sv) && mg_find(sv, PERL_MAGIC_tied)))
- RETPUSHYES;
- break;
- case SVt_PVCV:
- if (CvROOT(sv) || CvXSUB(sv))
- RETPUSHYES;
- break;
- default:
- SvGETMAGIC(sv);
- if (SvOK(sv))
- RETPUSHYES;
- }
- RETPUSHNO;
-}
-
PP(pp_undef)
{
dSP;
}
}
-PP(pp_dor)
+PP(pp_defined)
{
- /* Most of this is lifted straight from pp_defined */
dSP;
- register SV* const sv = TOPs;
-
- if (!sv || !SvANY(sv)) {
- --SP;
- RETURNOP(cLOGOP->op_other);
+ register SV* sv;
+ bool defined = FALSE;
+ const int op_type = PL_op->op_type;
+
+ if(op_type == OP_DOR) {
+ sv = TOPs;
+ if (!sv || !SvANY(sv)) {
+ --SP;
+ RETURNOP(cLOGOP->op_other);
+ }
+ } else if (op_type == OP_DEFINED) {
+ sv = POPs;
+ if (!sv || !SvANY(sv))
+ RETPUSHNO;
}
-
+
switch (SvTYPE(sv)) {
case SVt_PVAV:
if (AvMAX(sv) >= 0 || SvGMAGICAL(sv) || (SvRMAGICAL(sv) && mg_find(sv, PERL_MAGIC_tied)))
- RETURN;
+ defined = TRUE;
break;
case SVt_PVHV:
if (HvARRAY(sv) || SvGMAGICAL(sv) || (SvRMAGICAL(sv) && mg_find(sv, PERL_MAGIC_tied)))
- RETURN;
+ defined = TRUE;
break;
case SVt_PVCV:
if (CvROOT(sv) || CvXSUB(sv))
- RETURN;
+ defined = TRUE;
break;
default:
SvGETMAGIC(sv);
if (SvOK(sv))
- RETURN;
+ defined = TRUE;
}
- --SP;
- RETURNOP(cLOGOP->op_other);
+ if(defined) {
+ if(op_type == OP_DOR)
+ RETURN;
+ else if (op_type == OP_DEFINED)
+ RETPUSHYES;
+ }
+
+ if(op_type == OP_DOR) {
+ --SP;
+ RETURNOP(cLOGOP->op_other);
+ } else if (op_type == OP_DEFINED) {
+ RETPUSHNO;
+ }
}
PP(pp_add)