File Coverage

blib/lib/Acme/BABYMETAL/Base.pm
Criterion Covered Total %
statement 24 26 92.3
branch n/a
condition n/a
subroutine 6 7 85.7
pod 1 2 50.0
total 31 35 88.5


line stmt bran cond sub pod time code
1             package Acme::BABYMETAL::Base;
2 4     4   22 use strict;
  4         6  
  4         100  
3 4     4   18 use warnings;
  4         8  
  4         90  
4 4     4   5217 use DateTime;
  4         462404  
  4         150  
5 4     4   35 use base qw(Class::Accessor);
  4         8  
  4         3456  
6              
7             our $VERSION = '0.02';
8              
9             __PACKAGE__->mk_accessors(qw(
10             metal_name
11             name_ja
12             first_name_ja
13             family_name_ja
14             name_en
15             first_name_en
16             family_name_en
17             birthday
18             age
19             blood_type
20             hometown
21             ));
22              
23             sub new {
24 12     12 1 22 my $class = shift;
25 12         28 my $self = bless {}, $class;
26 12         123 $self->_initialize;
27 12         56 return $self;
28             }
29              
30             sub _initialize {
31 12     12   19 my $self = shift;
32 12         41 my %info = $self->info;
33              
34 12         178 $self->{$_} = $info{$_} for keys %info;
35 12         87 $self->{name_ja} = $self->family_name_ja . $self->first_name_ja;
36 12         366 $self->{name_en} = $self->first_name_en . ' ' . $self->family_name_en;
37 12         269 my ($year, $month, $day) = ($self->{birthday} =~ /^(\d{4})-(\d{2})-(\d{2})$/);
38 12         64 $self->{age} = (DateTime->now - DateTime->new(
39             year => $year,
40             month => $month,
41             day => $day,
42             ))->years;
43              
44 12         10847 return 1;
45             }
46              
47             sub shout {
48 0     0 0   my $self = shift;
49 0           print $self->metal_name . " DEATH!!\n";
50             }
51              
52              
53             1;
54