line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Generic Constructor Role for Perl 5 |
2
|
|
|
|
|
|
|
package Data::Object::Role::Constructor; |
3
|
|
|
|
|
|
|
|
4
|
15
|
|
|
15
|
|
8459
|
use 5.010; |
|
15
|
|
|
|
|
48
|
|
5
|
15
|
|
|
15
|
|
76
|
use Data::Object::Role; |
|
15
|
|
|
|
|
28
|
|
|
15
|
|
|
|
|
87
|
|
6
|
|
|
|
|
|
|
|
7
|
15
|
|
|
15
|
|
3965
|
use Scalar::Util 'blessed'; |
|
15
|
|
|
|
|
37
|
|
|
15
|
|
|
|
|
2921
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.42'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
10
|
|
|
10
|
0
|
10068
|
my $class = shift; |
13
|
10
|
|
|
|
|
28
|
my $data = shift; |
14
|
|
|
|
|
|
|
|
15
|
10
|
|
|
|
|
21
|
my $role = 'Data::Object::Role::Type'; |
16
|
|
|
|
|
|
|
|
17
|
10
|
50
|
66
|
|
|
123
|
$data = $data->data if blessed($data) |
|
|
|
33
|
|
|
|
|
18
|
|
|
|
|
|
|
and $data->can('does') |
19
|
|
|
|
|
|
|
and $data->does($role); |
20
|
|
|
|
|
|
|
|
21
|
10
|
50
|
66
|
|
|
106
|
if (blessed($data) && $data->isa('Regexp') && $^V <= v5.12.0) { |
|
|
|
66
|
|
|
|
|
22
|
0
|
|
|
|
|
0
|
$data = do {\(my $q = qr/$data/)}; |
|
0
|
|
|
|
|
0
|
|
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
10
|
100
|
|
|
|
66
|
return bless ref($data) ? $data : \$data, $class; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |