line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Object::InsideOut::Metadata; { |
2
|
|
|
|
|
|
|
|
3
|
53
|
|
|
53
|
|
169
|
use strict; |
|
53
|
|
|
|
|
707
|
|
|
53
|
|
|
|
|
2327
|
|
4
|
53
|
|
|
53
|
|
148
|
use warnings; |
|
53
|
|
|
|
|
56
|
|
|
53
|
|
|
|
|
3933
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '4.04'; |
7
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Stores method metadata |
10
|
|
|
|
|
|
|
# Initialized with our own metadata |
11
|
|
|
|
|
|
|
my %METADATA = ( |
12
|
|
|
|
|
|
|
'Object::InsideOut::Metadata' => { |
13
|
|
|
|
|
|
|
'add_meta' => {'hidden' => 1}, |
14
|
|
|
|
|
|
|
'AUTOLOAD' => {'hidden' => 1}, |
15
|
|
|
|
|
|
|
'new' => {'hidden' => 1}, |
16
|
|
|
|
|
|
|
'create_field' => {'hidden' => 1}, |
17
|
|
|
|
|
|
|
'add_class' => {'hidden' => 1}, |
18
|
|
|
|
|
|
|
'get_classes' => {'kind' => 'object'}, |
19
|
|
|
|
|
|
|
'get_methods' => {'kind' => 'object'}, |
20
|
|
|
|
|
|
|
'get_args' => {'kind' => 'object'}, |
21
|
|
|
|
|
|
|
}, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
### Exported Subroutines ### |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub import |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
# Export 'add_meta' call |
30
|
53
|
|
|
53
|
|
801
|
no strict 'refs'; |
|
53
|
|
|
|
|
685
|
|
|
53
|
|
|
|
|
16603
|
|
31
|
116
|
|
|
116
|
|
1492
|
my $caller = caller(); |
32
|
116
|
|
|
|
|
156
|
*{$caller.'::add_meta'} = \&add_meta; |
|
116
|
|
|
|
|
492
|
|
33
|
116
|
|
|
|
|
5578
|
$METADATA{$caller}{'add_meta'}{'hidden'} = 1; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Stores metadata for later use |
38
|
|
|
|
|
|
|
sub add_meta |
39
|
|
|
|
|
|
|
{ |
40
|
507
|
|
|
507
|
0
|
712
|
my ($class, $name, $meta, $value) = @_; |
41
|
|
|
|
|
|
|
|
42
|
507
|
100
|
|
|
|
773
|
if (@_ == 4) { |
43
|
89
|
|
|
|
|
219
|
$METADATA{$class}{$name}{$meta} = $value; |
44
|
|
|
|
|
|
|
} else { |
45
|
418
|
|
|
|
|
356
|
my $data; |
46
|
418
|
50
|
|
|
|
845
|
if (@_ == 3) { |
|
|
100
|
|
|
|
|
|
47
|
0
|
|
|
|
|
0
|
$$data{$class}{$name} = $meta; |
48
|
|
|
|
|
|
|
} elsif (@_ == 2) { |
49
|
233
|
|
|
|
|
368
|
$$data{$class} = $name; |
50
|
|
|
|
|
|
|
} else { |
51
|
185
|
|
|
|
|
195
|
$data = $class; |
52
|
|
|
|
|
|
|
} |
53
|
418
|
|
|
|
|
1302
|
while (my ($c, $mn) = each(%$data)) { |
54
|
543
|
|
|
|
|
1540
|
while (my ($n, $md) = each(%$mn)) { |
55
|
3745
|
|
|
|
|
5933
|
while (my ($m, $v) = each(%$md)) { |
56
|
5936
|
|
|
|
|
17796
|
$METADATA{$c}{$n}{$m} = $v; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# This will load the OO option of our code. |
65
|
|
|
|
|
|
|
# It's done this way because of circular dependencies with OIO. |
66
|
|
|
|
|
|
|
sub AUTOLOAD |
67
|
|
|
|
|
|
|
{ |
68
|
|
|
|
|
|
|
# Need 5.8.0 or later |
69
|
2
|
50
|
|
2
|
|
6
|
if ($] < 5.008) { |
70
|
0
|
|
|
|
|
0
|
OIO::Code->die('message' => q/Introspection API requires Perl 5.8.0 or later/, |
71
|
|
|
|
|
|
|
'ignore_package' => 'Object::InsideOut::Metadata'); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# It's a bug if not invoked by ->new() |
75
|
|
|
|
|
|
|
# This should only ever happen once |
76
|
2
|
50
|
|
|
|
6
|
if (our $AUTOLOAD ne 'Object::InsideOut::Metadata::new') { |
77
|
0
|
|
|
|
|
0
|
OIO::Method->die('message' => "Object::InsideOut::Metadata does not support AUTOLOAD of $AUTOLOAD", |
78
|
|
|
|
|
|
|
'ignore_package' => 'Object::InsideOut::Metadata'); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# Workaround to get %METADATA into our scope |
82
|
2
|
|
|
|
|
3
|
my $meta = \%METADATA; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# Load the rest of our code |
85
|
2
|
|
|
|
|
2
|
my $text = do { local $/; }; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
75
|
|
86
|
2
|
|
|
|
|
12
|
close(DATA); |
87
|
2
|
100
|
|
12
|
1
|
149
|
eval $text; |
|
12
|
100
|
|
16
|
1
|
4718
|
|
|
12
|
50
|
|
18
|
1
|
61
|
|
|
2
|
50
|
|
|
|
10
|
|
|
12
|
50
|
|
|
|
18
|
|
|
12
|
50
|
|
|
|
14
|
|
|
12
|
100
|
|
|
|
26
|
|
|
32
|
100
|
|
|
|
49
|
|
|
32
|
100
|
|
|
|
44
|
|
|
52
|
50
|
|
|
|
78
|
|
|
42
|
0
|
|
|
|
48
|
|
|
42
|
100
|
|
|
|
48
|
|
|
42
|
50
|
|
|
|
56
|
|
|
34
|
100
|
|
|
|
40
|
|
|
34
|
100
|
|
|
|
54
|
|
|
41
|
50
|
|
|
|
72
|
|
|
7
|
100
|
|
|
|
2
|
|
|
23
|
50
|
|
|
|
41
|
|
|
18
|
100
|
|
|
|
84
|
|
|
18
|
50
|
|
|
|
1209
|
|
|
2
|
100
|
|
|
|
2
|
|
|
18
|
100
|
|
|
|
598
|
|
|
12
|
100
|
|
|
|
15
|
|
|
12
|
100
|
|
|
|
14
|
|
|
12
|
100
|
|
|
|
8
|
|
|
12
|
100
|
|
|
|
28
|
|
|
8
|
100
|
|
|
|
11
|
|
|
8
|
100
|
|
|
|
8
|
|
|
8
|
100
|
|
|
|
19
|
|
|
4
|
100
|
|
|
|
3
|
|
|
12
|
|
|
|
|
42
|
|
|
4
|
|
|
|
|
3
|
|
|
8
|
|
|
|
|
13
|
|
|
0
|
|
|
|
|
0
|
|
|
12
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
13
|
|
|
12
|
|
|
|
|
25
|
|
|
10
|
|
|
|
|
33
|
|
|
14
|
|
|
|
|
2415
|
|
|
14
|
|
|
|
|
47
|
|
|
0
|
|
|
|
|
0
|
|
|
14
|
|
|
|
|
16
|
|
|
14
|
|
|
|
|
20
|
|
|
14
|
|
|
|
|
23
|
|
|
14
|
|
|
|
|
43
|
|
|
16
|
|
|
|
|
9175
|
|
|
16
|
|
|
|
|
54
|
|
|
0
|
|
|
|
|
0
|
|
|
16
|
|
|
|
|
17
|
|
|
16
|
|
|
|
|
16
|
|
|
16
|
|
|
|
|
18
|
|
|
16
|
|
|
|
|
23
|
|
|
36
|
|
|
|
|
26
|
|
|
8
|
|
|
|
|
15
|
|
|
36
|
|
|
|
|
50
|
|
|
36
|
|
|
|
|
24
|
|
|
36
|
|
|
|
|
278
|
|
|
1629
|
|
|
|
|
916
|
|
|
1629
|
|
|
|
|
3062
|
|
|
1285
|
|
|
|
|
1816
|
|
|
1203
|
|
|
|
|
1562
|
|
|
1109
|
|
|
|
|
1271
|
|
|
1109
|
|
|
|
|
1262
|
|
|
80
|
|
|
|
|
81
|
|
|
36
|
|
|
|
|
108
|
|
|
34
|
|
|
|
|
19
|
|
|
34
|
|
|
|
|
147
|
|
|
1063
|
|
|
|
|
1366
|
|
|
734
|
|
|
|
|
526
|
|
|
734
|
|
|
|
|
479
|
|
|
36
|
|
|
|
|
103
|
|
|
2
|
|
|
|
|
6
|
|
|
16
|
|
|
|
|
47
|
|
|
327
|
|
|
|
|
387
|
|
|
325
|
|
|
|
|
228
|
|
|
325
|
|
|
|
|
363
|
|
|
245
|
|
|
|
|
143
|
|
|
245
|
|
|
|
|
355
|
|
|
310
|
|
|
|
|
431
|
|
|
16
|
|
|
|
|
146
|
|
88
|
2
|
50
|
|
|
|
138
|
die if $@; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# Continue on |
91
|
2
|
|
|
|
|
6
|
goto &Object::InsideOut::new; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} # End of package's lexical scope |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__DATA__ |