line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
1366
|
use 5.008; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
89
|
|
2
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
61
|
|
3
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
97
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Class::Scaffold::Base; |
6
|
|
|
|
|
|
|
BEGIN { |
7
|
2
|
|
|
2
|
|
44
|
$Class::Scaffold::Base::VERSION = '1.102280'; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Base class for all classes of the class framework. |
11
|
2
|
|
|
2
|
|
11
|
use Data::Miscellany 'set_push'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
125
|
|
12
|
2
|
|
|
2
|
|
16
|
use Error::Hierarchy::Util 'load_class'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
118
|
|
13
|
2
|
|
|
|
|
17
|
use parent qw/ |
14
|
|
|
|
|
|
|
Data::Inherited |
15
|
|
|
|
|
|
|
Data::Comparable |
16
|
|
|
|
|
|
|
Error::Hierarchy::Mixin |
17
|
|
|
|
|
|
|
Class::Scaffold::Delegate::Mixin |
18
|
|
|
|
|
|
|
Class::Scaffold::Accessor |
19
|
|
|
|
|
|
|
Class::Scaffold::Factory::Type |
20
|
2
|
|
|
2
|
|
10
|
/; |
|
2
|
|
|
|
|
4
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# We subclass Class::Scaffold::Factory::Type so objects can introspect to see |
23
|
|
|
|
|
|
|
# which object type they are. |
24
|
|
|
|
|
|
|
__PACKAGE__->mk_constructor; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# so every_hash has something to fall back to: |
27
|
16
|
|
|
16
|
1
|
42747
|
sub FIRST_CONSTRUCTOR_ARGS { () } |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# so everyone can call SUPER:: without worries, just pass through the args: |
30
|
|
|
|
|
|
|
sub MUNGE_CONSTRUCTOR_ARGS { |
31
|
10
|
|
|
10
|
1
|
596
|
my $self = shift; |
32
|
10
|
|
|
|
|
40
|
@_; |
33
|
|
|
|
|
|
|
} |
34
|
18
|
|
|
18
|
1
|
1035
|
sub init { 1 } |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Convenience method so subclasses don't need to say |
37
|
|
|
|
|
|
|
# |
38
|
|
|
|
|
|
|
# use Class::Scaffold::Log; |
39
|
|
|
|
|
|
|
# my $log = Class::Scaffold::Log; |
40
|
|
|
|
|
|
|
# $log->info(...); |
41
|
|
|
|
|
|
|
# |
42
|
|
|
|
|
|
|
# or |
43
|
|
|
|
|
|
|
# |
44
|
|
|
|
|
|
|
# Class::Scaffold::Log->debug(...); |
45
|
|
|
|
|
|
|
# |
46
|
|
|
|
|
|
|
# but can say |
47
|
|
|
|
|
|
|
# |
48
|
|
|
|
|
|
|
# $self->log->info(...); |
49
|
|
|
|
|
|
|
# |
50
|
|
|
|
|
|
|
# Eliminating fixed package names is also a way of decoupling; later on we |
51
|
|
|
|
|
|
|
# might choose to get the log from the delegate or anywhere else, in which |
52
|
|
|
|
|
|
|
# case we can make the change in one location - here. |
53
|
|
|
|
|
|
|
# |
54
|
|
|
|
|
|
|
# Class::Scaffold::Log inherits from this class, so we don't use() it but |
55
|
|
|
|
|
|
|
# require() it, to avoid 'redefined' warnings. |
56
|
|
|
|
|
|
|
sub log { |
57
|
3
|
|
|
3
|
1
|
10
|
my $self = shift; |
58
|
3
|
|
|
|
|
1259
|
require Class::Scaffold::Log; |
59
|
3
|
|
|
|
|
31
|
Class::Scaffold::Log->instance; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# Try to load currently not loaded packages of the Class-Scaffold and other |
63
|
|
|
|
|
|
|
# registered distributions and call the wanted method. |
64
|
|
|
|
|
|
|
# |
65
|
|
|
|
|
|
|
# Throw an exception if the package in which we have to look for the wanted |
66
|
|
|
|
|
|
|
# method is already loaded (= the method doesn't exist). |
67
|
0
|
|
|
0
|
|
0
|
sub UNIVERSAL::DESTROY { } |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub UNIVERSAL::AUTOLOAD { |
70
|
4
|
|
|
4
|
|
27
|
my ($pkg, $method) = ($UNIVERSAL::AUTOLOAD =~ /(.*)::(.*)/); |
71
|
4
|
|
|
|
|
12
|
local $" = '|'; |
72
|
4
|
|
|
|
|
10
|
our @autoload_packages; |
73
|
4
|
50
|
|
|
|
90
|
unless ($pkg =~ /^(@autoload_packages)/) { |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# we don't deal with crappy external libs and |
76
|
|
|
|
|
|
|
# their problems. get lost with your symbol. |
77
|
0
|
|
|
|
|
0
|
require Carp; |
78
|
0
|
|
|
|
|
0
|
local $Carp::CarpLevel = 1; |
79
|
0
|
|
|
|
|
0
|
Carp::confess sprintf "Undefined subroutine &%s called", |
80
|
|
|
|
|
|
|
$UNIVERSAL::AUTOLOAD; |
81
|
|
|
|
|
|
|
} |
82
|
4
|
|
|
|
|
26
|
(my $key = "$pkg.pm") =~ s!::!/!g; |
83
|
4
|
|
|
|
|
12
|
local $Error::Depth = $Error::Depth + 1; |
84
|
4
|
100
|
|
|
|
16
|
if (exists $INC{$key}) { |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# package has been loaded already, so the method wanted |
87
|
|
|
|
|
|
|
# doesn't seem to exist. |
88
|
1
|
|
|
|
|
6
|
require Carp; |
89
|
1
|
|
|
|
|
3
|
local $Carp::CarpLevel = 1; |
90
|
1
|
|
|
|
|
29
|
Carp::confess sprintf "Undefined subroutine &%s called", |
91
|
|
|
|
|
|
|
$UNIVERSAL::AUTOLOAD; |
92
|
|
|
|
|
|
|
} else { |
93
|
3
|
|
|
|
|
16
|
load_class $pkg, 1; |
94
|
2
|
|
|
2
|
|
843
|
no warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
387
|
|
95
|
2
|
50
|
|
|
|
43
|
if (my $coderef = UNIVERSAL::can($pkg, $method)) { |
96
|
2
|
|
|
|
|
16
|
goto &$coderef; |
97
|
|
|
|
|
|
|
} else { |
98
|
0
|
|
|
|
|
0
|
require Carp; |
99
|
0
|
|
|
|
|
0
|
local $Carp::CarpLevel = 1; |
100
|
0
|
|
|
|
|
0
|
Carp::confess sprintf "Undefined subroutine &%s called", |
101
|
|
|
|
|
|
|
$UNIVERSAL::AUTOLOAD; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub add_autoloaded_package { |
107
|
2
|
50
|
|
2
|
1
|
10
|
shift if $_[0] eq __PACKAGE__; |
108
|
2
|
|
|
|
|
4
|
my $prefix = shift; |
109
|
2
|
|
|
|
|
6
|
our @autoload_packages; |
110
|
2
|
|
|
|
|
12
|
set_push @autoload_packages, $prefix; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
__END__ |