line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
package Acme::Marvel::CinematicUniverse::Character; |
3
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Class"; |
4
|
|
|
|
|
|
|
our $MITE_SHIM = "Acme::Marvel::CinematicUniverse::Mite"; |
5
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
37
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
BEGIN { |
9
|
1
|
|
|
1
|
|
4
|
*false = \&Acme::Marvel::CinematicUniverse::Mite::false; |
10
|
1
|
|
|
|
|
1046
|
*true = \&Acme::Marvel::CinematicUniverse::Mite::true; |
11
|
|
|
|
|
|
|
}; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
6
|
50
|
|
6
|
0
|
15
|
my $class = ref($_[0]) ? ref(shift) : shift; |
16
|
6
|
|
66
|
|
|
16
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
17
|
6
|
|
|
|
|
11
|
my $self = bless {}, $class; |
18
|
6
|
50
|
|
|
|
37
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
|
0
|
50
|
|
|
|
0
|
|
19
|
6
|
|
|
|
|
12
|
my $no_build = delete $args->{__no_BUILD__}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Initialize attributes |
22
|
6
|
50
|
0
|
|
|
13
|
if ( exists $args->{"real_name"} ) { do { package Acme::Marvel::CinematicUniverse::Mite; defined($args->{"real_name"}) and do { ref(\$args->{"real_name"}) eq 'SCALAR' or ref(\(my $val = $args->{"real_name"})) eq 'SCALAR' } } or require Carp && Carp::croak(sprintf "Type check failed in constructor: %s should be %s", "real_name", "Str"); $self->{"real_name"} = $args->{"real_name"}; } else { require Carp; Carp::croak("Missing key in constructor: real_name") }; |
|
6
|
50
|
|
|
|
7
|
|
|
6
|
50
|
|
|
|
14
|
|
|
6
|
50
|
|
|
|
22
|
|
|
6
|
|
|
|
|
32
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
23
|
6
|
50
|
0
|
|
|
8
|
if ( exists $args->{"hero_name"} ) { do { package Acme::Marvel::CinematicUniverse::Mite; defined($args->{"hero_name"}) and do { ref(\$args->{"hero_name"}) eq 'SCALAR' or ref(\(my $val = $args->{"hero_name"})) eq 'SCALAR' } } or require Carp && Carp::croak(sprintf "Type check failed in constructor: %s should be %s", "hero_name", "Str"); $self->{"hero_name"} = $args->{"hero_name"}; } else { require Carp; Carp::croak("Missing key in constructor: hero_name") }; |
|
6
|
50
|
|
|
|
11
|
|
|
6
|
50
|
|
|
|
10
|
|
|
6
|
50
|
|
|
|
33
|
|
|
6
|
|
|
|
|
13
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
24
|
6
|
50
|
0
|
|
|
9
|
if ( exists $args->{"intelligence"} ) { (do { package Acme::Marvel::CinematicUniverse::Mite; (do { my $tmp = $args->{"intelligence"}; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) } && do { package Acme::Marvel::CinematicUniverse::Mite; $args->{"intelligence"} > 0 }) or require Carp && Carp::croak(sprintf "Type check failed in constructor: %s should be %s", "intelligence", "PositiveInt"); $self->{"intelligence"} = $args->{"intelligence"}; } else { require Carp; Carp::croak("Missing key in constructor: intelligence") }; |
|
6
|
50
|
33
|
|
|
10
|
|
|
6
|
50
|
33
|
|
|
6
|
|
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
44
|
|
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
11
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
25
|
6
|
50
|
0
|
|
|
10
|
if ( exists $args->{"strength"} ) { (do { package Acme::Marvel::CinematicUniverse::Mite; (do { my $tmp = $args->{"strength"}; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) } && do { package Acme::Marvel::CinematicUniverse::Mite; $args->{"strength"} > 0 }) or require Carp && Carp::croak(sprintf "Type check failed in constructor: %s should be %s", "strength", "PositiveInt"); $self->{"strength"} = $args->{"strength"}; } else { require Carp; Carp::croak("Missing key in constructor: strength") }; |
|
6
|
50
|
33
|
|
|
9
|
|
|
6
|
50
|
33
|
|
|
7
|
|
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
30
|
|
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
17
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
26
|
6
|
50
|
0
|
|
|
10
|
if ( exists $args->{"speed"} ) { (do { package Acme::Marvel::CinematicUniverse::Mite; (do { my $tmp = $args->{"speed"}; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) } && do { package Acme::Marvel::CinematicUniverse::Mite; $args->{"speed"} > 0 }) or require Carp && Carp::croak(sprintf "Type check failed in constructor: %s should be %s", "speed", "PositiveInt"); $self->{"speed"} = $args->{"speed"}; } else { require Carp; Carp::croak("Missing key in constructor: speed") }; |
|
6
|
50
|
33
|
|
|
9
|
|
|
6
|
50
|
33
|
|
|
7
|
|
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
36
|
|
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
11
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
27
|
6
|
50
|
0
|
|
|
9
|
if ( exists $args->{"durability"} ) { (do { package Acme::Marvel::CinematicUniverse::Mite; (do { my $tmp = $args->{"durability"}; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) } && do { package Acme::Marvel::CinematicUniverse::Mite; $args->{"durability"} > 0 }) or require Carp && Carp::croak(sprintf "Type check failed in constructor: %s should be %s", "durability", "PositiveInt"); $self->{"durability"} = $args->{"durability"}; } else { require Carp; Carp::croak("Missing key in constructor: durability") }; |
|
6
|
50
|
33
|
|
|
8
|
|
|
6
|
50
|
33
|
|
|
9
|
|
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
39
|
|
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
12
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
28
|
6
|
50
|
0
|
|
|
13
|
if ( exists $args->{"energy_projection"} ) { (do { package Acme::Marvel::CinematicUniverse::Mite; (do { my $tmp = $args->{"energy_projection"}; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) } && do { package Acme::Marvel::CinematicUniverse::Mite; $args->{"energy_projection"} > 0 }) or require Carp && Carp::croak(sprintf "Type check failed in constructor: %s should be %s", "energy_projection", "PositiveInt"); $self->{"energy_projection"} = $args->{"energy_projection"}; } else { require Carp; Carp::croak("Missing key in constructor: energy_projection") }; |
|
6
|
50
|
33
|
|
|
8
|
|
|
6
|
50
|
33
|
|
|
10
|
|
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
29
|
|
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
11
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
29
|
6
|
50
|
0
|
|
|
10
|
if ( exists $args->{"fighting_ability"} ) { (do { package Acme::Marvel::CinematicUniverse::Mite; (do { my $tmp = $args->{"fighting_ability"}; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) } && do { package Acme::Marvel::CinematicUniverse::Mite; $args->{"fighting_ability"} > 0 }) or require Carp && Carp::croak(sprintf "Type check failed in constructor: %s should be %s", "fighting_ability", "PositiveInt"); $self->{"fighting_ability"} = $args->{"fighting_ability"}; } else { require Carp; Carp::croak("Missing key in constructor: fighting_ability") }; |
|
6
|
50
|
33
|
|
|
8
|
|
|
6
|
50
|
33
|
|
|
7
|
|
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
41
|
|
|
6
|
|
|
|
|
23
|
|
|
6
|
|
|
|
|
20
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Enforce strict constructor |
32
|
6
|
50
|
33
|
|
|
10
|
my @unknown = grep not( /\A(?:durability|energy_projection|fighting_ability|hero_name|intelligence|real_name|s(?:peed|trength))\z/ ), keys %{$args}; @unknown and require Carp and Carp::croak("Unexpected keys in constructor: " . join(q[, ], sort @unknown)); |
|
6
|
|
|
|
|
49
|
|
|
6
|
|
|
|
|
16
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Call BUILD methods |
35
|
6
|
50
|
33
|
|
|
13
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
|
6
|
50
|
|
|
|
21
|
|
36
|
|
|
|
|
|
|
|
37
|
6
|
|
|
|
|
28
|
return $self; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub BUILDALL { |
41
|
0
|
|
|
0
|
0
|
0
|
my $class = ref( $_[0] ); |
42
|
0
|
|
0
|
|
|
0
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
43
|
0
|
0
|
|
|
|
0
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
|
0
|
|
|
|
|
0
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub DESTROY { |
47
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
48
|
0
|
|
0
|
|
|
0
|
my $class = ref( $self ) || $self; |
49
|
0
|
|
0
|
|
|
0
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
50
|
0
|
0
|
|
|
|
0
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
51
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
52
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
53
|
0
|
0
|
|
|
|
0
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
|
0
|
|
|
|
|
0
|
|
54
|
0
|
|
|
|
|
0
|
my $e = do { |
55
|
0
|
|
|
|
|
0
|
local ( $?, $@ ); |
56
|
0
|
|
|
|
|
0
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
|
0
|
|
|
|
|
0
|
|
57
|
0
|
|
|
|
|
0
|
$@; |
58
|
|
|
|
|
|
|
}; |
59
|
1
|
|
|
1
|
|
7
|
no warnings 'misc'; # avoid (in cleanup) warnings |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
74
|
|
60
|
0
|
0
|
|
|
|
0
|
die $e if $e; # rethrow |
61
|
|
|
|
|
|
|
} |
62
|
0
|
|
|
|
|
0
|
return; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub __META__ { |
66
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
827
|
|
67
|
1
|
|
33
|
1
|
|
2
|
my $class = shift; $class = ref($class) || $class; |
|
1
|
|
|
|
|
4
|
|
68
|
1
|
|
|
|
|
4
|
my $linear_isa = mro::get_linear_isa( $class ); |
69
|
|
|
|
|
|
|
return { |
70
|
|
|
|
|
|
|
BUILD => [ |
71
|
1
|
50
|
|
|
|
2
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
1
|
|
|
|
|
5
|
|
|
0
|
|
|
|
|
0
|
|
72
|
1
|
|
|
|
|
3
|
map { "$_\::BUILD" } reverse @$linear_isa |
73
|
|
|
|
|
|
|
], |
74
|
|
|
|
|
|
|
DEMOLISH => [ |
75
|
1
|
50
|
|
|
|
2
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
1
|
|
|
|
|
13
|
|
|
0
|
|
|
|
|
0
|
|
76
|
1
|
|
|
|
|
3
|
map { "$_\::DEMOLISH" } @$linear_isa |
|
1
|
|
|
|
|
3
|
|
77
|
|
|
|
|
|
|
], |
78
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
79
|
|
|
|
|
|
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
80
|
|
|
|
|
|
|
}; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub DOES { |
84
|
0
|
|
|
0
|
0
|
|
my ( $self, $role ) = @_; |
85
|
0
|
|
|
|
|
|
our %DOES; |
86
|
0
|
0
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
87
|
0
|
0
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
88
|
0
|
|
|
|
|
|
return $self->SUPER::DOES( $role ); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub does { |
92
|
0
|
|
|
0
|
0
|
|
shift->DOES( @_ ); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
my $__XS = !$ENV{MITE_PURE_PERL} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# Accessors for durability |
98
|
|
|
|
|
|
|
if ( $__XS ) { |
99
|
|
|
|
|
|
|
Class::XSAccessor->import( |
100
|
|
|
|
|
|
|
chained => 1, |
101
|
|
|
|
|
|
|
"getters" => { "durability" => "durability" }, |
102
|
|
|
|
|
|
|
); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
else { |
105
|
|
|
|
|
|
|
*durability = sub { @_ > 1 ? require Carp && Carp::croak("durability is a read-only attribute of @{[ref $_[0]]}") : $_[0]{"durability"} }; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# Accessors for energy_projection |
109
|
|
|
|
|
|
|
if ( $__XS ) { |
110
|
|
|
|
|
|
|
Class::XSAccessor->import( |
111
|
|
|
|
|
|
|
chained => 1, |
112
|
|
|
|
|
|
|
"getters" => { "energy_projection" => "energy_projection" }, |
113
|
|
|
|
|
|
|
); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
else { |
116
|
|
|
|
|
|
|
*energy_projection = sub { @_ > 1 ? require Carp && Carp::croak("energy_projection is a read-only attribute of @{[ref $_[0]]}") : $_[0]{"energy_projection"} }; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
# Accessors for fighting_ability |
120
|
|
|
|
|
|
|
if ( $__XS ) { |
121
|
|
|
|
|
|
|
Class::XSAccessor->import( |
122
|
|
|
|
|
|
|
chained => 1, |
123
|
|
|
|
|
|
|
"getters" => { "fighting_ability" => "fighting_ability" }, |
124
|
|
|
|
|
|
|
); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
else { |
127
|
|
|
|
|
|
|
*fighting_ability = sub { @_ > 1 ? require Carp && Carp::croak("fighting_ability is a read-only attribute of @{[ref $_[0]]}") : $_[0]{"fighting_ability"} }; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
# Accessors for hero_name |
131
|
|
|
|
|
|
|
if ( $__XS ) { |
132
|
|
|
|
|
|
|
Class::XSAccessor->import( |
133
|
|
|
|
|
|
|
chained => 1, |
134
|
|
|
|
|
|
|
"getters" => { "hero_name" => "hero_name" }, |
135
|
|
|
|
|
|
|
); |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
else { |
138
|
|
|
|
|
|
|
*hero_name = sub { @_ > 1 ? require Carp && Carp::croak("hero_name is a read-only attribute of @{[ref $_[0]]}") : $_[0]{"hero_name"} }; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
# Accessors for intelligence |
142
|
|
|
|
|
|
|
if ( $__XS ) { |
143
|
|
|
|
|
|
|
Class::XSAccessor->import( |
144
|
|
|
|
|
|
|
chained => 1, |
145
|
|
|
|
|
|
|
"getters" => { "intelligence" => "intelligence" }, |
146
|
|
|
|
|
|
|
); |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
else { |
149
|
|
|
|
|
|
|
*intelligence = sub { @_ > 1 ? require Carp && Carp::croak("intelligence is a read-only attribute of @{[ref $_[0]]}") : $_[0]{"intelligence"} }; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# Accessors for real_name |
153
|
|
|
|
|
|
|
if ( $__XS ) { |
154
|
|
|
|
|
|
|
Class::XSAccessor->import( |
155
|
|
|
|
|
|
|
chained => 1, |
156
|
|
|
|
|
|
|
"getters" => { "real_name" => "real_name" }, |
157
|
|
|
|
|
|
|
); |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
else { |
160
|
|
|
|
|
|
|
*real_name = sub { @_ > 1 ? require Carp && Carp::croak("real_name is a read-only attribute of @{[ref $_[0]]}") : $_[0]{"real_name"} }; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
# Accessors for speed |
164
|
|
|
|
|
|
|
if ( $__XS ) { |
165
|
|
|
|
|
|
|
Class::XSAccessor->import( |
166
|
|
|
|
|
|
|
chained => 1, |
167
|
|
|
|
|
|
|
"getters" => { "speed" => "speed" }, |
168
|
|
|
|
|
|
|
); |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
else { |
171
|
|
|
|
|
|
|
*speed = sub { @_ > 1 ? require Carp && Carp::croak("speed is a read-only attribute of @{[ref $_[0]]}") : $_[0]{"speed"} }; |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
# Accessors for strength |
175
|
|
|
|
|
|
|
if ( $__XS ) { |
176
|
|
|
|
|
|
|
Class::XSAccessor->import( |
177
|
|
|
|
|
|
|
chained => 1, |
178
|
|
|
|
|
|
|
"getters" => { "strength" => "strength" }, |
179
|
|
|
|
|
|
|
); |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
else { |
182
|
|
|
|
|
|
|
*strength = sub { @_ > 1 ? require Carp && Carp::croak("strength is a read-only attribute of @{[ref $_[0]]}") : $_[0]{"strength"} }; |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
1; |
187
|
|
|
|
|
|
|
} |