| 1 | __END__ |
| 2 | # NAME my $<special> |
| 3 | my $!; |
| 4 | EXPECT |
| 5 | Can't use global $! in "my" at - line 1, near "my $!" |
| 6 | Execution of - aborted due to compilation errors. |
| 7 | ######## |
| 8 | # NAME OP_HELEM fields |
| 9 | package Foo; |
| 10 | use fields qw(a b); |
| 11 | sub new { |
| 12 | my $class = shift; |
| 13 | return fields::new($class); |
| 14 | } |
| 15 | my Foo $f = Foo->new; |
| 16 | $f->{c} = 1; |
| 17 | EXPECT |
| 18 | No 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 |
| 22 | my main $r; |
| 23 | ${$r}{key}; |
| 24 | EXPECT |
| 25 | No such class field "key" in variable $r of type main at - line 3. |
| 26 | ######## |
| 27 | # NAME OP_HSLICE fields |
| 28 | package Foo; |
| 29 | use fields qw(a b); |
| 30 | sub new { |
| 31 | my $class = shift; |
| 32 | return fields::new($class); |
| 33 | } |
| 34 | my Foo $f = Foo->new; |
| 35 | @$f{"a", "c"} = ( 1, 2 ); |
| 36 | EXPECT |
| 37 | No 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 |
| 41 | my main $f; |
| 42 | @$f{"a"}; |
| 43 | EXPECT |
| 44 | No such class field "a" in variable $f of type main at - line 3. |
| 45 | ######## |
| 46 | # NAME OP_KVHSLICE fields |
| 47 | BEGIN { %FIELDS = qw(a 1 b 1); } |
| 48 | my main $f; |
| 49 | %$f{"a","c"}; |
| 50 | EXPECT |
| 51 | No such class field "c" in variable $f of type main at - line 3. |
| 52 | ######## |
| 53 | # NAME Can't declare conditional |
| 54 | my($a?$b:$c) |
| 55 | EXPECT |
| 56 | Can't declare conditional expression in "my" at - line 1, at EOF |
| 57 | Execution of - aborted due to compilation errors. |
| 58 | ######## |
| 59 | # NAME Can't declare do block |
| 60 | my(do{}) |
| 61 | EXPECT |
| 62 | Can't declare do block in "my" at - line 1, at EOF |
| 63 | Execution of - aborted due to compilation errors. |
| 64 | ######## |
| 65 | # NAME delete BAD |
| 66 | delete $x; |
| 67 | EXPECT |
| 68 | delete argument is not a HASH or ARRAY element or slice at - line 1. |
| 69 | ######## |
| 70 | # NAME delete sort |
| 71 | use warnings; |
| 72 | delete sort; # used to warn about scalar context, too |
| 73 | EXPECT |
| 74 | delete argument is not a HASH or ARRAY element or slice at - line 2. |
| 75 | ######## |
| 76 | # NAME exists BAD |
| 77 | exists $x; |
| 78 | EXPECT |
| 79 | exists argument is not a HASH or ARRAY element or a subroutine at - line 1. |
| 80 | ######## |
| 81 | # NAME exists non-sub |
| 82 | exists &foo() |
| 83 | EXPECT |
| 84 | exists argument is not a subroutine name at - line 1. |
| 85 | ######## |
| 86 | # NAME push BAREWORD |
| 87 | no warnings 'experimental'; |
| 88 | push FRED; |
| 89 | EXPECT |
| 90 | Type of arg 1 to push must be array (not constant item) at - line 2, near "FRED;" |
| 91 | Execution of - aborted due to compilation errors. |
| 92 | ######## |
| 93 | # NAME pop BAREWORD |
| 94 | no warnings 'experimental'; |
| 95 | pop FRED; |
| 96 | EXPECT |
| 97 | Type of arg 1 to pop must be array (not constant item) at - line 2, near "FRED;" |
| 98 | Execution of - aborted due to compilation errors. |
| 99 | ######## |
| 100 | # NAME shift BAREWORD |
| 101 | no warnings 'experimental'; |
| 102 | shift FRED; |
| 103 | EXPECT |
| 104 | Type of arg 1 to shift must be array (not constant item) at - line 2, near "FRED;" |
| 105 | Execution of - aborted due to compilation errors. |
| 106 | ######## |
| 107 | # NAME unshift BAREWORD |
| 108 | no warnings 'experimental'; |
| 109 | unshift FRED; |
| 110 | EXPECT |
| 111 | Type of arg 1 to unshift must be array (not constant item) at - line 2, near "FRED;" |
| 112 | Execution of - aborted due to compilation errors. |
| 113 | ######## |
| 114 | # NAME keys BAREWORD |
| 115 | @a = keys FRED ; |
| 116 | EXPECT |
| 117 | Type of arg 1 to keys must be hash (not constant item) at - line 1, near "FRED ;" |
| 118 | Execution of - aborted due to compilation errors. |
| 119 | ######## |
| 120 | # NAME values BAREWORD |
| 121 | @a = values FRED ; |
| 122 | EXPECT |
| 123 | Type of arg 1 to values must be hash (not constant item) at - line 1, near "FRED ;" |
| 124 | Execution of - aborted due to compilation errors. |
| 125 | ######## |
| 126 | # NAME each BAREWORD |
| 127 | @a = each FRED ; |
| 128 | EXPECT |
| 129 | Type of arg 1 to each must be hash (not constant item) at - line 1, near "FRED ;" |
| 130 | Execution of - aborted due to compilation errors. |