line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::MixinFactory::Factory; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = 0.91; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
######################################################################## |
6
|
|
|
|
|
|
|
|
7
|
8
|
|
|
8
|
|
41
|
use strict; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
243
|
|
8
|
8
|
|
|
8
|
|
46
|
use Carp (); |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
177
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
######################################################################## |
11
|
|
|
|
|
|
|
|
12
|
8
|
|
|
8
|
|
5032
|
use Class::MixinFactory::InsideOutAttr qw(base_class mixin_prefix mixed_prefix); |
|
8
|
|
|
|
|
21
|
|
|
8
|
|
|
|
|
63
|
|
13
|
|
|
|
|
|
|
|
14
|
8
|
|
|
8
|
|
5985
|
use Class::MixinFactory::NEXT; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
3872
|
|
15
|
69
|
|
|
69
|
0
|
499
|
sub next_dispatch_class { 'Class::MixinFactory::NEXT' } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
######################################################################## |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new { |
20
|
4
|
|
|
4
|
1
|
8
|
my $sym; |
21
|
4
|
|
|
|
|
16
|
my $self = bless \$sym, shift; |
22
|
4
|
|
|
|
|
28
|
while ( my $method = shift @_ ) { |
23
|
2
|
|
|
|
|
12
|
$self->$method( shift ); |
24
|
|
|
|
|
|
|
} |
25
|
4
|
|
|
|
|
18
|
$self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
######################################################################## |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub class { |
31
|
78
|
|
|
78
|
1
|
9768
|
my $factory = shift; |
32
|
78
|
50
|
66
|
|
|
395
|
my @mixins = ( @_ == 1 and ref($_[0]) ) ? @{ $_[0] } : @_; |
|
0
|
|
|
|
|
0
|
|
33
|
|
|
|
|
|
|
|
34
|
78
|
|
|
|
|
228
|
my $base_class = $factory->base_class(); |
35
|
78
|
|
50
|
|
|
227
|
my $mixin_prefix = $factory->mixin_prefix() || $base_class || ''; |
36
|
78
|
|
66
|
|
|
370
|
my $mixed_prefix = $factory->mixed_prefix() || ( $base_class ? $base_class : ref($factory) || $factory ) . "::AUTO"; |
37
|
|
|
|
|
|
|
|
38
|
78
|
50
|
|
|
|
156
|
my @classes = map { ( $_ =~ /::/ ) ? $_ : $mixin_prefix ? $mixin_prefix . '::' . $_ : $_ } @mixins; |
|
122
|
50
|
|
|
|
556
|
|
39
|
|
|
|
|
|
|
|
40
|
78
|
|
|
|
|
260
|
my $label = join '_', map { s/^\Q$mixin_prefix\E:://; s/:://g; $_ } map "$_", @classes; |
|
122
|
|
|
|
|
799
|
|
|
122
|
|
|
|
|
194
|
|
|
122
|
|
|
|
|
302
|
|
41
|
|
|
|
|
|
|
|
42
|
78
|
|
100
|
|
|
330
|
my $new_class = $mixed_prefix . "::" . ( $label || "Base" ); |
43
|
|
|
|
|
|
|
|
44
|
8
|
100
|
|
8
|
|
64
|
return $new_class if do { no strict 'refs'; @{ "$new_class\::ISA" } }; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
560
|
|
|
78
|
|
|
|
|
88
|
|
|
78
|
|
|
|
|
96
|
|
|
78
|
|
|
|
|
1067
|
|
45
|
|
|
|
|
|
|
|
46
|
69
|
|
|
|
|
243
|
my @isa = ( @classes, $base_class, $factory->next_dispatch_class ); |
47
|
|
|
|
|
|
|
|
48
|
69
|
|
|
|
|
137
|
foreach my $package ( @classes ) { |
49
|
8
|
50
|
|
8
|
|
40
|
next if do { no strict 'refs'; scalar keys %{ $package . '::' } }; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
928
|
|
|
113
|
|
|
|
|
121
|
|
|
113
|
|
|
|
|
172
|
|
|
113
|
|
|
|
|
484
|
|
50
|
0
|
|
|
|
|
0
|
my $filename = "$package.pm"; |
51
|
0
|
|
|
|
|
0
|
$filename =~ s{::}{/}g; |
52
|
|
|
|
|
|
|
# warn "require $filename"; |
53
|
0
|
|
|
|
|
0
|
require $filename; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
8
|
|
|
8
|
|
41
|
{ no strict; @{ "$new_class\::ISA" } = @isa; } |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
1294
|
|
|
69
|
|
|
|
|
109
|
|
|
69
|
|
|
|
|
87
|
|
|
69
|
|
|
|
|
2039
|
|
57
|
|
|
|
|
|
|
|
58
|
69
|
|
|
|
|
3615
|
$new_class; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
######################################################################## |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |