22 my ($pack,$file,$line) = caller;
23 print "not ok $t # $file:$line\n";
28 my %hash = ( one => 1, two => 2);;
29 ok(!access::readonly(%hash));
31 ok(!access::readonly(%hash,1));
33 eval { $hash{'three'} = 3 };
35 ok($@ =~ /^Attempt to access to key 'three' in fixed hash/);
37 eval { print "# oops" if $hash{'four'}};
39 ok($@ =~ /^Attempt to access to key 'four' in fixed hash/);
41 eval { $hash{"\x{2323}"} = 3 };
43 ok($@ =~ /^Attempt to access to key '(.*)' in fixed hash/);
44 #ok(ord($1) == 0x2323);
46 eval { delete $hash{'one'}};
48 ok($@ =~ /^Attempt to access to key 'one' in fixed hash/);
50 ok(exists $hash{'one'});
52 ok(!exists $hash{'three'});
54 ok(access::readonly(%hash,0));
56 ok(!access::readonly(%hash));
59 ok(!access::readonly($scalar));
61 ok(!access::readonly($scalar,1));
65 ok($@ =~ /^Modification of a read-only value attempted/);
67 ok(access::readonly($scalar,0));
69 ok(!access::readonly($scalar));