line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: An Autobox Implementation for Perl 5 |
2
|
|
|
|
|
|
|
package Data::Object::Autobox; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
43968
|
use 5.010; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
80
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
68
|
|
7
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
77
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
8
|
use base 'autobox'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1077
|
|
10
|
2
|
|
|
2
|
|
40506
|
use Data::Object 'load'; |
|
2
|
|
|
|
|
8100
|
|
|
2
|
|
|
|
|
1061
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.11'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub import { |
15
|
2
|
|
|
2
|
|
40
|
my $class = shift; |
16
|
2
|
|
|
|
|
3
|
my $param = shift; |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
16
|
my ($default, %options) = ('composite', @_); |
19
|
2
|
100
|
|
|
|
22
|
my ($flavor) = $param =~ /^[-:](autoload|composite|custom)$/ if $param; |
20
|
|
|
|
|
|
|
|
21
|
2
|
100
|
33
|
|
|
22
|
$flavor = $default if ! $flavor |
|
|
|
66
|
|
|
|
|
22
|
|
|
|
|
|
|
or $flavor eq 'custom' and ! keys %options; |
23
|
|
|
|
|
|
|
|
24
|
2
|
100
|
|
|
|
9
|
unless (lc $flavor eq 'custom') { |
25
|
1
|
|
|
|
|
7
|
%options = ( |
26
|
|
|
|
|
|
|
ARRAY => load "${class}::\u${flavor}::Array", |
27
|
|
|
|
|
|
|
CODE => load "${class}::\u${flavor}::Code", |
28
|
|
|
|
|
|
|
FLOAT => load "${class}::\u${flavor}::Float", |
29
|
|
|
|
|
|
|
HASH => load "${class}::\u${flavor}::Hash", |
30
|
|
|
|
|
|
|
INTEGER => load "${class}::\u${flavor}::Integer", |
31
|
|
|
|
|
|
|
NUMBER => load "${class}::\u${flavor}::Number", |
32
|
|
|
|
|
|
|
SCALAR => load "${class}::\u${flavor}::Scalar", |
33
|
|
|
|
|
|
|
STRING => load "${class}::\u${flavor}::String", |
34
|
|
|
|
|
|
|
UNDEF => load "${class}::\u${flavor}::Undef", |
35
|
|
|
|
|
|
|
UNIVERSAL => load "${class}::\u${flavor}::Universal", |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
|
|
87
|
$class->SUPER::import(%options); |
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
|
|
3111
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |