line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Framework; |
2
|
1
|
|
|
1
|
|
1638
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
35
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1347
|
use Class::Accessor (); |
|
1
|
|
|
|
|
3103
|
|
|
1
|
|
|
|
|
23
|
|
6
|
1
|
|
|
1
|
|
6
|
use Class::MethodVars (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
756
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.'.qw $Rev: 228 $[1]; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub insert_base($$) { |
11
|
0
|
|
|
0
|
0
|
|
my ($package,$base) = @_; |
12
|
0
|
0
|
|
|
|
|
eval "unshift(\@${package}::ISA,q($base))" unless $package->isa($base); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub add_base($@) { |
16
|
0
|
|
|
0
|
0
|
|
my ($package,@base) = @_; |
17
|
0
|
0
|
|
|
|
|
eval "package $package; use base qw( @base ); 1" or die $@; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub import { |
21
|
0
|
|
|
0
|
|
|
shift; # I don't care about what package this is. You should never be @ISA = "Class::Framework". |
22
|
0
|
|
|
|
|
|
my $package = caller; |
23
|
0
|
|
|
|
|
|
for (my $i = 0; $i < @_; $i++) { |
24
|
0
|
0
|
|
|
|
|
next unless $_[$i] eq '-base'; |
25
|
0
|
0
|
0
|
|
|
|
if (ref($_[$i+1]) and ref($_[$i+1]) eq 'ARRAY' and not grep { not /\A\w+(?:::\w+)*\z/ } @{$_[$i+1]}) { |
|
0
|
0
|
0
|
|
|
|
|
|
0
|
|
0
|
|
|
|
|
26
|
0
|
|
|
|
|
|
add_base($package,@{$_[$i+1]}); |
|
0
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
splice(@_,$i,2); |
28
|
0
|
|
|
|
|
|
last; |
29
|
|
|
|
|
|
|
} elsif ( (not ref($_[$i+1])) and $_[$i+1]=~/\A\w+(?:::\w+)*\z/ ) { |
30
|
0
|
|
|
|
|
|
add_base($package,$_[$i+1]); |
31
|
0
|
|
|
|
|
|
splice(@_,$i,2); |
32
|
0
|
|
|
|
|
|
last; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
0
|
|
|
|
|
|
insert_base $package,"Class::Accessor"; |
36
|
0
|
|
|
|
|
|
insert_base $package,"Class::Framework::New"; |
37
|
0
|
0
|
|
|
|
|
eval "package $package; Class::MethodVars->import(\@_); 1" or die $@; # And this is where the rest of @_ is used... |
38
|
0
|
|
|
|
|
|
my @fields = @{$Class::MethodVars::Configs{$package}->{fields}}; |
|
0
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my @rwfields = @{$Class::MethodVars::Configs{$package}->{rwfields}}; |
|
0
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my @rofields = @{$Class::MethodVars::Configs{$package}->{rofields}}; |
|
0
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my @wofields = @{$Class::MethodVars::Configs{$package}->{wofields}}; |
|
0
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# There are also "hiddenfields" which don't get accessors... |
43
|
0
|
0
|
|
|
|
|
eval "package $package; use fields \@fields; 1" or die $@; |
44
|
0
|
0
|
|
|
|
|
$package->mk_accessors(@rwfields) if @rwfields; |
45
|
0
|
0
|
|
|
|
|
$package->mk_accessors(@rofields) if @rofields; |
46
|
0
|
0
|
|
|
|
|
$package->mk_accessors(@wofields) if @wofields; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
package Class::Framework::New; |
51
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
52
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
36
|
|
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
1
|
|
4
|
use Class::MethodVars; # Defaults - I only need __CLASS__ anyway. |
|
1
|
|
|
|
|
25
|
|
|
1
|
|
|
|
|
8
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub new :ClassMethod { |
57
|
0
|
|
|
0
|
|
|
my $fields; |
58
|
0
|
0
|
0
|
|
|
|
if (@_ == 1 and ref($_[0]) and $_[0]->isa("HASH")) { |
|
|
0
|
0
|
|
|
|
|
59
|
0
|
|
|
|
|
|
$fields = shift; |
60
|
|
|
|
|
|
|
} elsif ((@_ % 2) == 0) { |
61
|
0
|
|
|
|
|
|
$fields = {@_}; |
62
|
|
|
|
|
|
|
} |
63
|
0
|
|
|
|
|
|
my $me = fields::new(__CLASS__); # Note that __CLASS__ could be different to __PACKAGE__! |
64
|
0
|
0
|
|
|
|
|
%$me = %$fields if $fields; |
65
|
0
|
0
|
|
|
|
|
if ($me->can("_INIT")) { |
66
|
0
|
|
|
|
|
|
$me->_INIT(@_); |
67
|
|
|
|
|
|
|
} |
68
|
0
|
|
|
|
|
|
return $me; |
69
|
1
|
|
|
1
|
|
1456
|
} |
|
1
|
|
|
|
|
1764
|
|
|
1
|
|
|
|
|
7
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
__END__ |