if (o->op_private & OPpLVAL_DEFER)
sv_catpv(tmpsv, ",LVAL_DEFER");
}
+ else if ((optype == OP_RV2HV || optype == OP_PADHV)
+ && o->op_private & OpMAYBE_TRUEBOOL) {
+ sv_catpvs(tmpsv, ",OpMAYBE_TRUEBOOL");
+ }
else {
if (o->op_private & HINT_STRICT_REFS)
sv_catpv(tmpsv, ",STRICT_REFS");
"enteriter");
$priv{$_}{8} = 'LVSUB' for qw(rv2av rv2gv rv2hv padav padhv aelem helem
aslice hslice av2arylen keys rkeys substr pos vec);
+$priv{$_}{64} = 'BOOL' for 'rv2hv', 'padhv';
$priv{substr}{16} = 'REPL1ST';
$priv{$_}{16} = "TARGMY"
for (map(($_,"s$_"),"chop", "chomp"),
|| o->op_type == OP_AND )
&& fopishv)
cLOGOP->op_first = opt_scalarhv(fop);
+ else if (!(lop->op_flags & OPf_WANT)) {
+ if (fop->op_type == OP_SCALAR)
+ fop = cUNOPx(fop)->op_first;
+ fop->op_private |= OpMAYBE_TRUEBOOL;
+ }
if ( (lop->op_flags & OPf_WANT) == OPf_WANT_VOID
&& sopishv)
cLOGOP->op_first->op_sibling = opt_scalarhv(sop);
/* OP_RV2[AGH]V, OP_PAD[AH]V, OP_[AH]ELEM, OP_[AH]SLICE OP_AV2ARYLEN,
OP_R?KEYS, OP_SUBSTR, OP_POS, OP_VEC */
#define OPpMAYBE_LVSUB 8 /* We might be an lvalue to return */
+ /* OP_RV2HV and OP_PADHV */
+#define OpMAYBE_TRUEBOOL 64 /* %hash in (%hash || $foo) where
+ cx is not known till run time */
/* OP_SUBSTR only */
#define OPpSUBSTR_REPL_FIRST 16 /* 1st arg is replacement string */
if (gimme == G_ARRAY) {
RETURNOP(Perl_do_kv(aTHX));
}
+ else if (PL_op->op_private & OpMAYBE_TRUEBOOL
+ && block_gimme() == G_VOID)
+ SETs(boolSV(HvUSEDKEYS(TARG)));
else if (gimme == G_SCALAR) {
SV* const sv = Perl_hv_scalar(aTHX_ MUTABLE_HV(TARG));
SETs(sv);
*PL_stack_sp = sv;
return Perl_do_kv(aTHX);
}
+ else if (PL_op->op_private & OpMAYBE_TRUEBOOL
+ && block_gimme() == G_VOID)
+ SETs(boolSV(HvUSEDKEYS(sv)));
else if (gimme == G_SCALAR) {
dTARGET;
TARG = Perl_hv_scalar(aTHX_ MUTABLE_HV(sv));