line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# A Generic Constructor Role for Perl 5 |
2
|
|
|
|
|
|
|
package Data::Object::Role::Constructor; |
3
|
|
|
|
|
|
|
|
4
|
15
|
|
|
15
|
|
7242
|
use 5.010; |
|
15
|
|
|
|
|
43
|
|
|
15
|
|
|
|
|
616
|
|
5
|
15
|
|
|
15
|
|
66
|
use Data::Object::Role; |
|
15
|
|
|
|
|
21
|
|
|
15
|
|
|
|
|
88
|
|
6
|
|
|
|
|
|
|
|
7
|
15
|
|
|
15
|
|
3843
|
use Scalar::Util 'blessed'; |
|
15
|
|
|
|
|
30
|
|
|
15
|
|
|
|
|
2523
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.20'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
10
|
|
|
10
|
0
|
10147
|
my $class = shift; |
13
|
10
|
|
|
|
|
23
|
my $data = shift; |
14
|
|
|
|
|
|
|
|
15
|
10
|
|
33
|
|
|
60
|
$class = ref($class) || $class; |
16
|
10
|
50
|
66
|
|
|
130
|
if (blessed($data) && $data->isa('Regexp') && $^V <= v5.12.0) { |
|
|
|
66
|
|
|
|
|
17
|
0
|
|
|
|
|
0
|
$data = do {\(my $q = qr/$data/)}; |
|
0
|
|
|
|
|
0
|
|
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
10
|
100
|
|
|
|
70
|
return bless ref($data) ? $data : \$data, $class; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |