line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Nefarious; |
2
|
7
|
|
|
7
|
|
299864
|
use 5.006; use strict; use warnings; |
|
7
|
|
|
7
|
|
53
|
|
|
7
|
|
|
7
|
|
101
|
|
|
7
|
|
|
|
|
23
|
|
|
7
|
|
|
|
|
92
|
|
|
7
|
|
|
|
|
85
|
|
|
7
|
|
|
|
|
30
|
|
|
7
|
|
|
|
|
110
|
|
3
|
7
|
|
|
7
|
|
2449
|
use Factory::Sub; use Tie::IxHash; our %META; |
|
7
|
|
|
7
|
|
245897
|
|
|
7
|
|
|
|
|
27
|
|
|
7
|
|
|
|
|
2341
|
|
|
7
|
|
|
|
|
18152
|
|
|
7
|
|
|
|
|
240
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
BEGIN { |
7
|
7
|
|
|
7
|
|
250
|
tie %META, 'Tie::IxHash'; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub import { |
11
|
6
|
|
|
6
|
|
920
|
my ($pkg, $nefarious) = @_; |
12
|
6
|
|
|
|
|
18
|
nefarious($nefarious); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub nefarious { |
16
|
6
|
|
|
6
|
0
|
11
|
my ($nefarious) = @_; |
17
|
6
|
|
|
|
|
11
|
for my $package ( keys %{ $nefarious }) { |
|
6
|
|
|
|
|
27
|
|
18
|
5
|
|
|
|
|
15
|
parse_meta($package, $nefarious->{$package}); |
19
|
|
|
|
|
|
|
} |
20
|
6
|
|
|
|
|
47
|
create_packages(); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub parse_meta { |
24
|
7
|
|
|
7
|
0
|
13
|
my ($name, $package) = @_; |
25
|
7
|
50
|
|
|
|
38
|
$META{$name} = {} if (! $META{$name} ); |
26
|
7
|
|
|
|
|
179
|
for my $key (keys %{ $package }) { |
|
7
|
|
|
|
|
21
|
|
27
|
25
|
|
|
|
|
136
|
my $ref = ref $package->{$key}; |
28
|
25
|
100
|
|
|
|
65
|
if (!$ref) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
29
|
7
|
100
|
|
|
|
15
|
if ($key eq 'EXTENDS') { |
30
|
4
|
|
|
|
|
11
|
$META{$name}{$key} = $package->{$key}; |
31
|
|
|
|
|
|
|
} else { |
32
|
3
|
|
|
3
|
|
14
|
$META{$name}{$key} = sub { $package->{$key} }; |
|
3
|
|
|
|
|
6179
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} elsif ($ref eq 'CODE') { |
35
|
14
|
|
|
|
|
40
|
$META{$name}{$key} = $package->{$key}; |
36
|
|
|
|
|
|
|
} elsif ($ref eq 'ARRAY') { |
37
|
2
|
|
|
|
|
10
|
my $factory = Factory::Sub->new(); |
38
|
2
|
|
|
|
|
11
|
for my $fact (reverse @{ $package->{$key} }) { |
|
2
|
|
|
|
|
6
|
|
39
|
6
|
100
|
|
|
|
85
|
$factory->add(ref $fact eq 'ARRAY' ? @{ $fact } : $fact); |
|
4
|
|
|
|
|
12
|
|
40
|
|
|
|
|
|
|
} |
41
|
2
|
|
|
6
|
|
21
|
$META{$name}{$key} = sub { shift; return $factory->(@_) }; |
|
6
|
|
|
|
|
2661
|
|
|
6
|
|
|
|
|
84
|
|
42
|
|
|
|
|
|
|
} elsif ($ref eq 'HASH') { |
43
|
2
|
|
|
|
|
4
|
$package->{$key}->{EXTENDS} = $name; |
44
|
2
|
|
|
|
|
7
|
parse_meta($key, $package->{$key}); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub create_packages { |
50
|
6
|
|
|
6
|
0
|
23
|
for my $pkg ( keys %META ) { |
51
|
10
|
|
|
|
|
119
|
create_package($pkg, $META{$pkg}); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub create_package { |
57
|
10
|
|
|
10
|
0
|
33
|
my ($name, $package) = @_; |
58
|
10
|
|
100
|
|
|
102
|
my $extends = delete $package->{EXTENDS} || ""; |
59
|
10
|
100
|
|
|
|
41
|
$extends = qq|use base '$extends';| if ($extends); |
60
|
10
|
100
|
|
7
|
|
44
|
$package->{new} = sub { bless {}, $name } if (! $package->{new}); |
|
7
|
|
|
|
|
7262
|
|
61
|
10
|
|
|
|
|
32
|
my $p = qq| |
62
|
|
|
|
|
|
|
package $name; |
63
|
|
|
|
|
|
|
use strict; |
64
|
|
|
|
|
|
|
use warnings; |
65
|
|
|
|
|
|
|
$extends |
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|; |
68
|
10
|
|
|
3
|
|
716
|
eval $p; |
|
3
|
|
|
3
|
|
22
|
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
69
|
|
|
3
|
|
|
|
|
17
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
66
|
|
69
|
7
|
|
|
4
|
|
2119
|
no strict 'refs'; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
1068
|
|
70
|
10
|
|
|
|
|
20
|
for my $method (keys %{$package}) { |
|
10
|
|
|
|
|
40
|
|
71
|
39
|
|
|
|
|
62
|
*{"${name}::$method"} = $package->{$method}; |
|
39
|
|
|
|
|
338
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |