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
|
|
911
|
use 5.10.0; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
55
|
|
5
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
200
|
|
6
|
1
|
|
|
1
|
|
20
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
51
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
731
|
use Data::Object; |
|
1
|
|
|
|
|
3218
|
|
|
1
|
|
|
|
|
82
|
|
9
|
1
|
|
|
1
|
|
904
|
use Readonly; |
|
1
|
|
|
|
|
4698
|
|
|
1
|
|
|
|
|
230
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.02'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
4
|
|
|
4
|
0
|
7278
|
my $class = shift; |
15
|
4
|
|
|
|
|
8
|
my $data = shift; |
16
|
4
|
|
|
|
|
29
|
my $self = Data::Object->new($data); |
17
|
4
|
|
|
|
|
140975
|
my $type = $self->objtype; |
18
|
|
|
|
|
|
|
|
19
|
4
|
100
|
|
|
|
98
|
if ('HASH' eq $type) { Readonly::Hash %$self => %$self; } |
|
1
|
100
|
|
|
|
9
|
|
20
|
1
|
|
|
|
|
8
|
elsif ('ARRAY' eq $type) { Readonly::Array @$self => @$self; } |
21
|
2
|
|
|
|
|
62
|
else { Readonly::Scalar $$self => $$self; } |
22
|
|
|
|
|
|
|
|
23
|
4
|
|
|
|
|
212
|
return $self; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__END__ |