1 # Check that the magic signature at the top of struct p_state works and that we
2 # catch modifications to _hparser_xs_state gracefully
4 use Test::More tests => 5;
8 $p = HTML::Parser->new(api_version => 3);
12 # We should not be able to simply modify this stuff
14 ${$p->{_hparser_xs_state}} += 4;
16 like($@, qr/^Modification of a read-only value attempted/);
19 my $x = delete $p->{_hparser_xs_state};
24 like($@, qr/^Can't find '_hparser_xs_state'/);
26 $p->{_hparser_xs_state} = \($$x + 16);
31 like($@, $] >= 5.008 ? qr/^Lost parser state magic/ : qr/^Bad signature in parser state object/);
33 $p->{_hparser_xs_state} = 33;
37 like($@, qr/^_hparser_xs_state element is not a reference/);
39 $p->{_hparser_xs_state} = $x;