line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mason::t::LvalueAttributes; |
2
|
|
|
|
|
|
|
$Mason::t::LvalueAttributes::VERSION = '2.24'; |
3
|
1
|
|
|
1
|
|
853
|
use Test::Class::Most parent => 'Mason::Test::Class'; |
|
1
|
|
|
|
|
30503
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
__PACKAGE__->default_plugins( [ '@Default', 'LvalueAttributes' ] ); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub test_lvalue : Tests { |
8
|
1
|
|
|
1
|
0
|
820
|
my $self = shift; |
9
|
1
|
|
|
|
|
16
|
$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
|
1
|
|
|
1
|
|
153
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |