10 no warnings 'experimental::refaliasing';
11 use vars qw($data $array $values $hash $errpat);
18 # Checking for a comma after the line number ensures that we are using
19 # yyerror for the error, rather than croak. yyerror is preferable for
20 # compile-time errors.
22 qr/Experimental $_[0] on scalar is now forbidden .* line 1\.(?x:
23 ).*Type of arg 1 to $_[0] must be hash or array \(not (?x:
32 'Errors: keys undef throws error'
38 'Errors: keys $undef throws error'
41 is($empty, undef, 'keys $undef does not vivify $undef');
44 like($@, qr/Type of arg 1 to keys must be hash/,
45 'Errors: keys CONSTANT throws error'
50 'Errors: keys qr/foo/ throws error'
53 eval q"keys $hash qw/fo bar/";
55 'Errors: keys $hash, @stuff throws error'
56 ) or print "# Got: $@";
63 'Errors: values undef throws error'
67 eval q"values $empty";
69 'Errors: values $undef throws error'
72 is($empty, undef, 'values $undef does not vivify $undef');
75 like($@, qr/Type of arg 1 to values must be hash/,
76 'Errors: values CONSTANT throws error'
79 eval "values qr/foo/";
81 'Errors: values qr/foo/ throws error'
84 eval q"values $hash qw/fo bar/";
86 'Errors: values $hash, @stuff throws error'
87 ) or print "# Got: $@";
94 'Errors: each undef throws error'
100 'Errors: each $undef throws error'
103 is($empty, undef, 'each $undef does not vivify $undef');
106 like($@, qr/Type of arg 1 to each must be hash/,
107 'Errors: each CONSTANT throws error'
112 'Errors: each qr/foo/ throws error'
115 eval q"each $hash qw/foo bar/";
117 'Errors: each $hash, @stuff throws error'
118 ) or print "# Got: $@";