line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mason::t::LvalueAttributes; |
2
|
|
|
|
|
|
|
$Mason::t::LvalueAttributes::VERSION = '2.22'; |
3
|
1
|
|
|
1
|
|
1531
|
use Test::Class::Most parent => 'Mason::Test::Class'; |
|
1
|
|
|
|
|
38990
|
|
|
1
|
|
|
|
|
9
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
__PACKAGE__->default_plugins( [ '@Default', 'LvalueAttributes' ] ); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub test_lvalue : Tests { |
8
|
|
|
|
|
|
|
my $self = shift; |
9
|
|
|
|
|
|
|
$self->test_comp( |
10
|
|
|
|
|
|
|
src => ' |
11
|
|
|
|
|
|
|
<%class> |
12
|
|
|
|
|
|
|
has "a" => (is => "rw"); |
13
|
|
|
|
|
|
|
has "b" => (is => "ro"); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
</%class> |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
<%init> |
18
|
|
|
|
|
|
|
$.a = 5; |
19
|
|
|
|
|
|
|
print "a = " . $.a . "\n"; |
20
|
|
|
|
|
|
|
$.a(6); |
21
|
|
|
|
|
|
|
print "a = " . $.a . "\n"; |
22
|
|
|
|
|
|
|
eval { $.b = 6 }; |
23
|
|
|
|
|
|
|
print $@ . "\n"; |
24
|
|
|
|
|
|
|
</%init> |
25
|
|
|
|
|
|
|
', |
26
|
|
|
|
|
|
|
expect => qr/a = 5\na = 6\nCan't modify.*/, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |