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