line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Immutable Data Type Objects for Perl 5 |
2
|
|
|
|
|
|
|
package Data::Object::Immutable; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
638
|
use 5.10.0; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
5
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
6
|
1
|
|
|
1
|
|
12
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
457
|
use Data::Object; |
|
1
|
|
|
|
|
2177
|
|
|
1
|
|
|
|
|
53
|
|
9
|
1
|
|
|
1
|
|
536
|
use Readonly; |
|
1
|
|
|
|
|
2262
|
|
|
1
|
|
|
|
|
134
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.03'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
4
|
|
|
4
|
0
|
7553
|
my $self = Data::Object->new(pop); |
15
|
4
|
|
|
|
|
107466
|
my $type = $self->objtype; |
16
|
|
|
|
|
|
|
|
17
|
4
|
100
|
|
|
|
77
|
if ($type eq 'HASH') { Readonly::Hash %$self => %$self; } |
|
1
|
100
|
|
|
|
6
|
|
18
|
1
|
|
|
|
|
6
|
elsif ($type eq 'ARRAY') { Readonly::Array @$self => @$self; } |
19
|
2
|
|
|
|
|
54
|
else { Readonly::Scalar $$self => $$self; } |
20
|
|
|
|
|
|
|
|
21
|
4
|
|
|
|
|
163
|
return $self; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |