On Tue, Nov 22, 2011 at 8:23 AM, Ricardo Signes
<perl.p5p@rjbs.manxome.org>wrote:
> ...but:
>
> perl -E'use warnings; defined(our @a)'
> (no deprecation)
>
> (package hashes are still deprecated)
>
>
Actually, it gets weirder:
perl -we 'print defined(%hash = ())'
defined(@array) is deprecated at -e line 1.
(Maybe you should just omit the defined()?)
OP_RV2AV is explicitly ignored, but I don't quite follow the reason, and
OP_AASSIGN incorrectly catches %hash = () as @array = ()...
OP *
Perl_ck_defined(pTHX_ OP *o) /* 19990527 MJD */
{
PERL_ARGS_ASSERT_CK_DEFINED;
if ((o->op_flags & OPf_KIDS)) {
switch (cUNOPo->op_first->op_type) {
case OP_RV2AV:
/* This is needed for
if (defined %stash::)
to work. Do not break Tk.
*/
break; /* Globals via GV can be undef */
case OP_PADAV:
case OP_AASSIGN: /* Is this a good idea? */
Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
"defined(@array) is deprecated");
Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
"\t(Maybe you should just omit the
defined()?)\n");
-- Matthew Horsfall (alh)
Thread Previous
|
Thread Next