4 use Test::More tests => 3;
6 my $Has_PH = $] < 5.009;
7 my $Field = $Has_PH ? "pseudo-hash field" : "class field";
11 use fields qw(this that);
12 sub new { fields::new(shift) }
20 my Child $obj = Child->new;
22 eval q(return; my Child $obj3 = $obj; $obj3->{notthere} = "");
24 qr/^No such .*field "notthere" in variable \$obj3 of type Child/,
25 "Compile failure of undeclared fields (helem)";
28 # We should get compile time failures field name typos
30 skip("Pseudo-hashes do not support compile-time slice checks", 2)
33 eval q(return; my Child $obj3 = $obj; my $k; @$obj3{$k,'notthere'} = ());
35 qr/^No such .*field "notthere" in variable \$obj3 of type Child/,
36 "Compile failure of undeclared fields (hslice)";
38 eval q(return; my Child $obj3 = $obj; my $k; @{$obj3}{$k,'notthere'} = ());
40 $@, qr/^No such .*field "notthere" in variable \$obj3 of type Child/,
41 "Compile failure of undeclared fields (hslice (block form))";