SV *msg = sv_2mortal(
newSVpvf("(Did you mean $ or @ instead of %c?)\n",
type == OP_ENTERSUB ? '&' : '%'));
- if (PL_in_eval & 2)
+ if (PL_in_eval & EVAL_WARNONLY)
warn("%_", msg);
else if (PL_in_eval)
sv_catsv(GvSV(PL_errgv), msg);
OP *kid;
char* useless = 0;
SV* sv;
+ U8 want;
+
+ if (o->op_type == OP_NEXTSTATE || o->op_type == OP_DBSTATE ||
+ (o->op_type == OP_NULL &&
+ (o->op_targ == OP_NEXTSTATE || o->op_targ == OP_DBSTATE)))
+ {
+ dTHR;
+ PL_curcop = (COP*)o; /* for warning below */
+ }
/* assumes no premature commitment */
- U8 want = o->op_flags & OPf_WANT;
- if (!o || (want && want != OPf_WANT_SCALAR) || PL_error_count
+ want = o->op_flags & OPf_WANT;
+ if ((want && want != OPf_WANT_SCALAR) || PL_error_count
|| o->op_type == OP_RETURN)
return o;
useless = "a variable";
break;
- case OP_NEXTSTATE:
- case OP_DBSTATE:
- WITH_THR(PL_curcop = ((COP*)o)); /* for warning below */
- break;
-
case OP_CONST:
sv = cSVOPo->op_sv;
if (cSVOPo->op_private & OPpCONST_STRICT)
break;
case OP_NULL:
- if (o->op_targ == OP_NEXTSTATE || o->op_targ == OP_DBSTATE)
- WITH_THR(PL_curcop = ((COP*)o)); /* for warning below */
if (o->op_flags & OPf_STACKED)
break;
/* FALL THROUGH */
+ case OP_NEXTSTATE:
+ case OP_DBSTATE:
case OP_ENTERTRY:
case OP_ENTER:
case OP_SCALAR:
if (PL_in_eval) {
if (PL_eval_root)
return;
- PL_eval_root = newUNOP(OP_LEAVEEVAL, ((PL_in_eval & 4) ? OPf_SPECIAL : 0), o);
+ PL_eval_root = newUNOP(OP_LEAVEEVAL,
+ ((PL_in_eval & EVAL_KEEPERR)
+ ? OPf_SPECIAL : 0), o);
PL_eval_start = linklist(PL_eval_root);
PL_eval_root->op_next = 0;
peep(PL_eval_start);
if (strEQ(s, "BEGIN")) {
char *not_safe =
"BEGIN not safe after errors--compilation aborted";
- if (PL_in_eval & 4)
+ if (PL_in_eval & EVAL_KEEPERR)
croak(not_safe);
else {
/* force display of errors found but not reported */
}
OP *
+ck_defined(OP *o) /* 19990527 MJD */
+{
+ if (ckWARN(WARN_DEPRECATED)) {
+ switch (cUNOPo->op_first->op_type) {
+ case OP_RV2AV:
+ case OP_PADAV:
+ case OP_AASSIGN: /* Is this a good idea? */
+ warner(WARN_DEPRECATED, "defined(@array) is deprecated (and not really meaningful)");
+ warner(WARN_DEPRECATED, "(Maybe you should just omit the defined()?)\n");
+ break;
+ case OP_RV2HV:
+ case OP_PADHV:
+ warner(WARN_DEPRECATED, "defined(%hash) is deprecated (and not really meaningful)");
+ warner(WARN_DEPRECATED, "(Maybe you should just omit the defined()?)\n");
+ break;
+ default:
+ /* no warning */
+ break;
+ }
+ }
+ return ck_rfun(o);
+}
+
+OP *
ck_rfun(OP *o)
{
OPCODE type = o->op_type;