line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Common Methods for Operating on Defined Values |
2
|
|
|
|
|
|
|
package Bubblegum::Object::Universal; |
3
|
|
|
|
|
|
|
|
4
|
39
|
|
|
39
|
|
347
|
use 5.10.0; |
|
39
|
|
|
|
|
857
|
|
|
39
|
|
|
|
|
1503
|
|
5
|
39
|
|
|
39
|
|
924
|
use namespace::autoclean; |
|
39
|
|
|
|
|
57
|
|
|
39
|
|
|
|
|
272
|
|
6
|
|
|
|
|
|
|
|
7
|
39
|
|
|
39
|
|
2228
|
use Bubblegum::Namespace; |
|
39
|
|
|
|
|
63
|
|
|
39
|
|
|
|
|
237
|
|
8
|
|
|
|
|
|
|
|
9
|
39
|
|
|
39
|
|
143
|
use Scalar::Util (); |
|
39
|
|
|
|
|
48
|
|
|
39
|
|
|
|
|
1079
|
|
10
|
39
|
|
|
39
|
|
21778
|
use Types::Standard (); |
|
39
|
|
|
|
|
2037556
|
|
|
39
|
|
|
|
|
1331
|
|
11
|
|
|
|
|
|
|
|
12
|
39
|
|
|
39
|
|
267
|
use Class::Load 'load_class'; |
|
39
|
|
|
|
|
112
|
|
|
39
|
|
|
|
|
12807
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @ISA = (); # non-object |
15
|
|
|
|
|
|
|
my $TYPES = $Bubblegum::Namespace::ExtendedTypes; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.45'; # VERSION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub digest { |
20
|
2
|
|
|
2
|
1
|
9293
|
my $self = CORE::shift; |
21
|
2
|
|
|
|
|
12
|
return wrapper($self, 'Digest'); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub dump { |
25
|
4
|
|
|
4
|
0
|
6
|
my $self = CORE::shift; |
26
|
4
|
|
|
|
|
11
|
return dumper($self)->encode; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub dumper { |
30
|
6
|
|
|
6
|
1
|
795
|
my $self = CORE::shift; |
31
|
6
|
|
|
|
|
17
|
return wrapper($self, 'Dumper'); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub encoder { |
35
|
2
|
|
|
2
|
1
|
2756
|
my $self = CORE::shift; |
36
|
2
|
|
|
|
|
11
|
return wrapper($self, 'Encoder'); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub instance { |
40
|
0
|
|
|
0
|
1
|
0
|
my $self = CORE::shift; |
41
|
0
|
|
|
|
|
0
|
my $class = $$TYPES{'INSTANCE'}; |
42
|
0
|
|
|
|
|
0
|
return load_class($class)->new( |
43
|
|
|
|
|
|
|
data => $self |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub json { |
48
|
2
|
|
|
2
|
1
|
1139
|
my $self = CORE::shift; |
49
|
2
|
|
|
|
|
7
|
return wrapper($self, 'Json'); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub refaddr { |
53
|
0
|
|
|
0
|
0
|
0
|
return Scalar::Util::refaddr( |
54
|
|
|
|
|
|
|
CORE::shift |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub reftype { |
59
|
0
|
|
|
0
|
0
|
0
|
return Scalar::Util::reftype( |
60
|
|
|
|
|
|
|
CORE::shift |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub wrapper { |
65
|
19
|
|
|
19
|
1
|
4080
|
my $self = CORE::shift; |
66
|
19
|
|
|
|
|
32
|
my $class = CORE::shift; |
67
|
19
|
|
|
|
|
56
|
my $wrapper = $$TYPES{'WRAPPER'}; |
68
|
19
|
|
|
|
|
102
|
return load_class(join('::', $wrapper, $class))->new( |
69
|
|
|
|
|
|
|
data => $self |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub yaml { |
74
|
2
|
|
|
2
|
1
|
2848
|
my $self = CORE::shift; |
75
|
2
|
|
|
|
|
9
|
return wrapper($self, 'Yaml'); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
{ |
79
|
39
|
|
|
39
|
|
198
|
no warnings 'once'; |
|
39
|
|
|
|
|
58
|
|
|
39
|
|
|
|
|
19896
|
|
80
|
|
|
|
|
|
|
*asa_aref = \&Types::Standard::assert_ArrayRef; |
81
|
|
|
|
|
|
|
*asa_arrayref = \&Types::Standard::assert_ArrayRef; |
82
|
|
|
|
|
|
|
*asa_bool = \&Types::Standard::assert_Bool; |
83
|
|
|
|
|
|
|
*asa_boolean = \&Types::Standard::assert_Bool; |
84
|
|
|
|
|
|
|
*asa_class = \&Types::Standard::assert_ClassName; |
85
|
|
|
|
|
|
|
*asa_classname = \&Types::Standard::assert_ClassName; |
86
|
|
|
|
|
|
|
*asa_coderef = \&Types::Standard::assert_CodeRef; |
87
|
|
|
|
|
|
|
*asa_cref = \&Types::Standard::assert_CodeRef; |
88
|
|
|
|
|
|
|
*asa_def = \&Types::Standard::assert_Defined; |
89
|
|
|
|
|
|
|
*asa_defined = \&Types::Standard::assert_Defined; |
90
|
|
|
|
|
|
|
*asa_fh = \&Types::Standard::assert_FileHandle; |
91
|
|
|
|
|
|
|
*asa_filehandle = \&Types::Standard::assert_FileHandle; |
92
|
|
|
|
|
|
|
*asa_glob = \&Types::Standard::assert_GlobRef; |
93
|
|
|
|
|
|
|
*asa_globref = \&Types::Standard::assert_GlobRef; |
94
|
|
|
|
|
|
|
*asa_hashref = \&Types::Standard::assert_HashRef; |
95
|
|
|
|
|
|
|
*asa_href = \&Types::Standard::assert_HashRef; |
96
|
|
|
|
|
|
|
*asa_int = \&Types::Standard::assert_Int; |
97
|
|
|
|
|
|
|
*asa_integer = \&Types::Standard::assert_Int; |
98
|
|
|
|
|
|
|
*asa_nil = \&Types::Standard::assert_Undef; |
99
|
|
|
|
|
|
|
*asa_null = \&Types::Standard::assert_Undef; |
100
|
|
|
|
|
|
|
*asa_num = \&Types::Standard::assert_Num; |
101
|
|
|
|
|
|
|
*asa_number = \&Types::Standard::assert_Num; |
102
|
|
|
|
|
|
|
*asa_obj = \&Types::Standard::assert_Object; |
103
|
|
|
|
|
|
|
*asa_object = \&Types::Standard::assert_Object; |
104
|
|
|
|
|
|
|
*asa_ref = \&Types::Standard::assert_Ref; |
105
|
|
|
|
|
|
|
*asa_reference = \&Types::Standard::assert_Ref; |
106
|
|
|
|
|
|
|
*asa_regexpref = \&Types::Standard::assert_RegexpRef; |
107
|
|
|
|
|
|
|
*asa_rref = \&Types::Standard::assert_RegexpRef; |
108
|
|
|
|
|
|
|
*asa_scalarref = \&Types::Standard::assert_ScalarRef; |
109
|
|
|
|
|
|
|
*asa_sref = \&Types::Standard::assert_ScalarRef; |
110
|
|
|
|
|
|
|
*asa_str = \&Types::Standard::assert_Str; |
111
|
|
|
|
|
|
|
*asa_string = \&Types::Standard::assert_Str; |
112
|
|
|
|
|
|
|
*asa_undef = \&Types::Standard::assert_Undef; |
113
|
|
|
|
|
|
|
*asa_undefined = \&Types::Standard::assert_Undef; |
114
|
|
|
|
|
|
|
*asa_val = \&Types::Standard::assert_Value; |
115
|
|
|
|
|
|
|
*asa_value = \&Types::Standard::assert_Value; |
116
|
|
|
|
|
|
|
*isa_aref = \&Types::Standard::is_ArrayRef; |
117
|
|
|
|
|
|
|
*isa_arrayref = \&Types::Standard::is_ArrayRef; |
118
|
|
|
|
|
|
|
*isa_bool = \&Types::Standard::is_Bool; |
119
|
|
|
|
|
|
|
*isa_boolean = \&Types::Standard::is_Bool; |
120
|
|
|
|
|
|
|
*isa_class = \&Types::Standard::is_ClassName; |
121
|
|
|
|
|
|
|
*isa_classname = \&Types::Standard::is_ClassName; |
122
|
|
|
|
|
|
|
*isa_coderef = \&Types::Standard::is_CodeRef; |
123
|
|
|
|
|
|
|
*isa_cref = \&Types::Standard::is_CodeRef; |
124
|
|
|
|
|
|
|
*isa_def = \&Types::Standard::is_Defined; |
125
|
|
|
|
|
|
|
*isa_defined = \&Types::Standard::is_Defined; |
126
|
|
|
|
|
|
|
*isa_fh = \&Types::Standard::is_FileHandle; |
127
|
|
|
|
|
|
|
*isa_filehandle = \&Types::Standard::is_FileHandle; |
128
|
|
|
|
|
|
|
*isa_glob = \&Types::Standard::is_GlobRef; |
129
|
|
|
|
|
|
|
*isa_globref = \&Types::Standard::is_GlobRef; |
130
|
|
|
|
|
|
|
*isa_hashref = \&Types::Standard::is_HashRef; |
131
|
|
|
|
|
|
|
*isa_href = \&Types::Standard::is_HashRef; |
132
|
|
|
|
|
|
|
*isa_int = \&Types::Standard::is_Int; |
133
|
|
|
|
|
|
|
*isa_integer = \&Types::Standard::is_Int; |
134
|
|
|
|
|
|
|
*isa_nil = \&Types::Standard::is_Undef; |
135
|
|
|
|
|
|
|
*isa_null = \&Types::Standard::is_Undef; |
136
|
|
|
|
|
|
|
*isa_num = \&Types::Standard::is_Num; |
137
|
|
|
|
|
|
|
*isa_number = \&Types::Standard::is_Num; |
138
|
|
|
|
|
|
|
*isa_obj = \&Types::Standard::is_Object; |
139
|
|
|
|
|
|
|
*isa_object = \&Types::Standard::is_Object; |
140
|
|
|
|
|
|
|
*isa_ref = \&Types::Standard::is_Ref; |
141
|
|
|
|
|
|
|
*isa_reference = \&Types::Standard::is_Ref; |
142
|
|
|
|
|
|
|
*isa_regexpref = \&Types::Standard::is_RegexpRef; |
143
|
|
|
|
|
|
|
*isa_rref = \&Types::Standard::is_RegexpRef; |
144
|
|
|
|
|
|
|
*isa_scalarref = \&Types::Standard::is_ScalarRef; |
145
|
|
|
|
|
|
|
*isa_sref = \&Types::Standard::is_ScalarRef; |
146
|
|
|
|
|
|
|
*isa_str = \&Types::Standard::is_Str; |
147
|
|
|
|
|
|
|
*isa_string = \&Types::Standard::is_Str; |
148
|
|
|
|
|
|
|
*isa_undef = \&Types::Standard::is_Undef; |
149
|
|
|
|
|
|
|
*isa_undefined = \&Types::Standard::is_Undef; |
150
|
|
|
|
|
|
|
*isa_val = \&Types::Standard::is_Value; |
151
|
|
|
|
|
|
|
*isa_value = \&Types::Standard::is_Value; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
1; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
__END__ |