File Coverage

blib/lib/Acme/Marvel/CinematicUniverse/Character.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 1 1 100.0
total 31 31 100.0


line stmt bran cond sub pod time code
1 1     1   16 use 5.008;
  1         4  
2 1     1   6 use strict;
  1         2  
  1         31  
3 1     1   7 use warnings;
  1         2  
  1         73  
4              
5             package Acme::Marvel::CinematicUniverse::Character;
6              
7             our $AUTHORITY = 'cpan:TOBYINK';
8             our $VERSION = '0.001';
9              
10 1         5 use Class::Tiny qw(
11             real_name
12             hero_name
13             intelligence
14             strength
15             speed
16             durability
17             energy_projection
18             fighting_ability
19 1     1   485 );
  1         1827  
20              
21             use overload (
22 1     1   98 q[bool] => sub { !!1 },
23 13     13   487 q[""] => sub { shift->real_name },
24 3     3   592 q[0+] => sub { shift->power },
25 1         12 fallback => !!1,
26 1     1   1165 );
  1         3  
27              
28             sub power {
29 3     3 1 5 my $self = shift;
30 3         6 my $sum;
31 3         63 $sum += $self->$_ for qw(
32             intelligence
33             strength
34             speed
35             durability
36             energy_projection
37             fighting_ability
38             );
39 3         301 return $sum;
40             }
41              
42             1;
43              
44             __END__