return o;
}
else if ((o->op_type == OP_RV2AV || o->op_type == OP_PADAV)) {
- Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
- "Using an array as a reference is deprecated");
+ Perl_croak(aTHX_ "Can't use an array as a reference");
}
return newUNOP(OP_RV2AV, 0, scalar(o));
}
return o;
}
else if ((o->op_type == OP_RV2HV || o->op_type == OP_PADHV)) {
- Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
- "Using a hash as a reference is deprecated");
+ Perl_croak(aTHX_ "Can't use a hash as a reference");
}
return newUNOP(OP_RV2HV, 0, scalar(o));
}
(F) You tried to call perl with the B<-m> switch, but you put something
other than "=" after the module name.
+=item Can't use a hash as a reference
+
+(F) You tried to use a hash as a reference, as in
+C<< %foo->{"bar"} >> or C<< %$ref->{"hello"} >>. Versions of perl <= 5.6.1
+used to allow this syntax, but shouldn't have.
+
+=item Can't use an array as a reference
+
+(F) You tried to use an array as a reference, as in
+C<< @foo->[23] >> or C<< @$ref->[99] >>. Versions of perl <= 5.6.1 used to
+allow this syntax, but shouldn't have.
+
=item Can't use anonymous symbol table for method lookup
(F) The internal routine that does method lookup was handed a symbol
You need to add either braces or blanks to disambiguate.
-=item Using a hash as a reference is deprecated
-
-(D deprecated) You tried to use a hash as a reference, as in
-C<< %foo->{"bar"} >> or C<< %$ref->{"hello"} >>. Versions of perl <= 5.6.1
-used to allow this syntax, but shouldn't have. It is now
-deprecated, and will be removed in a future version.
-
-=item Using an array as a reference is deprecated
-
-(D deprecated) You tried to use an array as a reference, as in
-C<< @foo->[23] >> or C<< @$ref->[99] >>. Versions of perl <= 5.6.1 used to
-allow this syntax, but shouldn't have. It is now deprecated,
-and will be removed in a future version.
-
=item Using just the first character returned by \N{} in character class in
regex; marked by S<<-- HERE> in m/%s/
Execution of - aborted due to compilation errors.
########
# op.c
-my (@foo, %foo);
-%main::foo->{"bar"};
-%foo->{"bar"};
-@main::foo->[23];
-@foo->[23];
-$main::foo = {}; %$main::foo->{"bar"};
-$foo = {}; %$foo->{"bar"};
-$main::foo = []; @$main::foo->[34];
-$foo = []; @$foo->[34];
-no warnings 'deprecated';
+my %foo;
%main::foo->{"bar"};
+EXPECT
+OPTION fatal
+Can't use a hash as a reference at - line 3.
+########
+# op.c
+my %foo;
%foo->{"bar"};
+EXPECT
+OPTION fatal
+Can't use a hash as a reference at - line 3.
+########
+# op.c
+my @foo;
@main::foo->[23];
+EXPECT
+OPTION fatal
+Can't use an array as a reference at - line 3.
+########
+# op.c
+my @foo;
@foo->[23];
+EXPECT
+OPTION fatal
+Can't use an array as a reference at - line 3.
+########
+# op.c
+my %foo;
$main::foo = {}; %$main::foo->{"bar"};
+EXPECT
+OPTION fatal
+Can't use a hash as a reference at - line 3.
+########
+# op.c
+my %foo;
$foo = {}; %$foo->{"bar"};
+EXPECT
+OPTION fatal
+Can't use a hash as a reference at - line 3.
+########
+# op.c
+my @foo;
$main::foo = []; @$main::foo->[34];
+EXPECT
+OPTION fatal
+Can't use an array as a reference at - line 3.
+########
+# op.c
+my @foo;
$foo = []; @$foo->[34];
EXPECT
-Using a hash as a reference is deprecated at - line 3.
-Using a hash as a reference is deprecated at - line 4.
-Using an array as a reference is deprecated at - line 5.
-Using an array as a reference is deprecated at - line 6.
-Using a hash as a reference is deprecated at - line 7.
-Using a hash as a reference is deprecated at - line 8.
-Using an array as a reference is deprecated at - line 9.
-Using an array as a reference is deprecated at - line 10.
+OPTION fatal
+Can't use an array as a reference at - line 3.
########
# op.c
use warnings 'void' ; no warnings 'experimental::smartmatch'; close STDIN ;
# use strict;
-plan tests => 44;
+plan tests => 40;
# simple use cases
{
is (scalar @warn, 0, 'no warning in list context');
}
- # deprecated syntax
{
my $h = \%h;
- @warn = ();
- ok( eq_array([eval '%$h->{a}'], ['A']), 'works, but deprecated' );
- is (scalar @warn, 1, 'one warning');
- like $warn[0], qr{^Using a hash as a reference is deprecated},
- "correct warning text";
+ eval '%$h->{a}';
+ like($@, qr/Can't use a hash as a reference/, 'hash reference is error' );
- @warn = ();
- ok( eq_array([eval '%$h->{"b","c"}'], [undef]), 'works, but deprecated' );
- is (scalar @warn, 1, 'one warning');
- like $warn[0], qr{^Using a hash as a reference is deprecated},
- "correct warning text";
+ eval '%$h->{"b","c"}';
+ like($@, qr/Can't use a hash as a reference/, 'hash slice reference is error' );
}
}