1__END__ 2# NAME my $<special> 3my $!; 4EXPECT 5Can't use global $! in "my" at - line 1, near "my $!" 6Execution of - aborted due to compilation errors. 7######## 8# NAME OP_HELEM fields 9package Foo; 10use fields qw(a b); 11sub new { 12 my $class = shift; 13 return fields::new($class); 14} 15my Foo $f = Foo->new; 16$f->{c} = 1; 17EXPECT 18No such class field "c" in variable $f of type Foo at - line 8. 19######## 20# NAME "No such field" with block: ${$ref}{key} 21%FIELDS; # empty hash so all keys are invalid 22my main $r; 23${$r}{key}; 24EXPECT 25No such class field "key" in variable $r of type main at - line 3. 26######## 27# NAME OP_HSLICE fields 28package Foo; 29use fields qw(a b); 30sub new { 31 my $class = shift; 32 return fields::new($class); 33} 34my Foo $f = Foo->new; 35@$f{"a", "c"} = ( 1, 2 ); 36EXPECT 37No such class field "c" in variable $f of type Foo at - line 8. 38######## 39# NAME Single OP_HSLICE field 40%FIELDS; # vivify it, but leave it empty, so all fields are invalid 41my main $f; 42@$f{"a"}; 43EXPECT 44No such class field "a" in variable $f of type main at - line 3. 45######## 46# NAME OP_KVHSLICE fields 47BEGIN { %FIELDS = qw(a 1 b 1); } 48my main $f; 49%$f{"a","c"}; 50EXPECT 51No such class field "c" in variable $f of type main at - line 3. 52######## 53# NAME Can't declare conditional 54my($a?$b:$c) 55EXPECT 56Can't declare conditional expression in "my" at - line 1, at EOF 57Execution of - aborted due to compilation errors. 58######## 59# NAME Can't declare do block 60my(do{}) 61EXPECT 62Can't declare do block in "my" at - line 1, at EOF 63Execution of - aborted due to compilation errors. 64######## 65# NAME delete BAD 66delete $x; 67EXPECT 68delete argument is not a HASH or ARRAY element or slice at - line 1. 69######## 70# NAME delete sort 71use warnings; 72delete sort; # used to warn about scalar context, too 73EXPECT 74delete argument is not a HASH or ARRAY element or slice at - line 2. 75######## 76# NAME exists BAD 77exists $x; 78EXPECT 79exists argument is not a HASH or ARRAY element or a subroutine at - line 1. 80######## 81# NAME exists non-sub 82exists &foo() 83EXPECT 84exists argument is not a subroutine name at - line 1. 85