line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WoW::Armory::Class; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
89
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
52
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
12
|
use base 'Class::Accessor'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
2156
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
5245
|
use constant FIELDS => []; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
138
|
|
9
|
2
|
|
|
2
|
|
10
|
use constant BLESSED_FIELDS => {}; |
|
2
|
|
|
|
|
24
|
|
|
2
|
|
|
|
|
89
|
|
10
|
2
|
|
|
2
|
|
10
|
use constant LIST_FIELDS => {}; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
933
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
2107
|
|
|
2107
|
1
|
15954
|
my ($proto, $fields) = @_; |
14
|
|
|
|
|
|
|
|
15
|
2107
|
|
33
|
|
|
6676
|
my $class = ref $proto || $proto; |
16
|
2107
|
|
|
|
|
6567
|
my $self = $class->SUPER::new($fields); |
17
|
|
|
|
|
|
|
|
18
|
2107
|
|
|
|
|
27849
|
for my $field (keys %$self) { |
19
|
13802
|
50
|
|
|
|
25211
|
next if !defined $self->{$field}; |
20
|
13802
|
100
|
|
|
|
63124
|
if ($class->BLESSED_FIELDS()->{$field}) { |
|
|
100
|
|
|
|
|
|
21
|
527
|
|
|
|
|
2084
|
$self->{$field} = $class->BLESSED_FIELDS()->{$field}->new($self->{$field}); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
elsif ($class->LIST_FIELDS()->{$field}) { |
24
|
137
|
|
|
|
|
142
|
$_ = $class->LIST_FIELDS()->{$field}->new($_) for @{$self->{$field}}; |
|
137
|
|
|
|
|
627
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
2107
|
|
|
|
|
11941
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub mk_accessors { |
32
|
92
|
|
|
92
|
1
|
184
|
my ($proto, @fields) = @_; |
33
|
|
|
|
|
|
|
|
34
|
92
|
|
33
|
|
|
370
|
my $class = ref $proto || $proto; |
35
|
|
|
|
|
|
|
|
36
|
92
|
|
|
|
|
982
|
$class->SUPER::mk_accessors( |
37
|
|
|
|
|
|
|
@fields, |
38
|
92
|
|
|
|
|
678
|
@{$class->FIELDS()}, |
39
|
92
|
|
|
|
|
885
|
keys %{$class->BLESSED_FIELDS()}, |
40
|
92
|
|
|
|
|
204
|
keys %{$class->LIST_FIELDS()} |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub accessor_name_for { |
45
|
1312
|
|
|
1312
|
1
|
29441
|
my ($self, $field) = @_; |
46
|
1312
|
|
|
|
|
2310
|
$field =~ s/[^a-z0-9_]/_/gi; |
47
|
1312
|
|
|
|
|
3198
|
return $field; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub mutator_name_for { |
51
|
656
|
|
|
656
|
1
|
3671
|
return shift->accessor_name_for(@_); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |