blib/lib/Acme/Hidek.pm

filter: Statementstmt 51.3% 37 / 72 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 85.7% 12 / 14 Podpod 0.0% 0 / 3 totaltotal 53.0% 52 / 98 SCAR 17.8
CC
4
Cov
51%
ossan40
6.0
ossan41
6.0
is_birthday
2.3
CRAP 5.9
↑ Summary blib/lib/Acme/Hidek/Congrats.pm »
1 package Acme::Hidek;
2  
3 2 ▶use 5.008_001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Time::Piece;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Time::HiRes qw(sleep);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 ▶if ($^O eq 'MSWin32') {
Branch: 2 branches
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 2 2
elsif ($ENV{'CONSOLE_ENCODING'}) { } 0 2 2
10 0 require 'Win32/Console/ANSI.pm';
11 0 binmode STDOUT, ":raw :encoding(cp932)";
12 }
13 elsif($ENV{CONSOLE_ENCODING}) {
14 0 binmode STDOUT, ":raw :encoding($ENV{CONSOLE_ENCODING})";
15 }
16  
17 2 our $VERSION = '43.0';
18  
19 2 ▶use XSLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 XSLoader::load(__PACKAGE__, $VERSION);
21  
22 use constant {
23 2 BIRTH_YEAR => 1970,
24 BIRTH_MONTH => 9,
25 BIRTH_DAY => 2,
26 2 ▶};
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 has agef => (
29 is => 'ro',
30 isa => 'Num',
31 lazy => 1,
32 default => sub {
33 1 ▶ my($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
34 1 return +(Time::Piece->localtime - $self->birthdate)->years;
35 },
36 2 );
37  
38 has age => (
39 is => 'ro',
40 isa => 'Int',
41 lazy => 1,
42 default => sub {
43 1 ▶ my($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
44 1 return int( $self->agef );
45 },
46 2 );
47  
48 has birthdate => (
49 is => 'ro',
50 isa => 'Object',
51 lazy => 1,
52 1 ▶ default => sub { Time::Piece->strptime("1970/9/2", "%Y/%m/%d") },
Subroutine __ANON__: called CC=1 SCAR=0.0
53 2 init_arg => undef,
54 );
55  
56 sub is_birthday {
57 1 ▶ my $now = Time::Piece->new;
Subroutine is_birthday: called CC=2 SCAR=8.1
Pod undocumented
58 1 ▶ return $now->mday == BIRTH_DAY && $now->mon == BIRTH_MONTH;
Condition33%1/3
$now->mday == 2 && $now->mon == 9
!ll&&!rl&&r
100
MC/DC0%0/2
$now->mday == 2 && $now->mon == 9
$now->mday == 2 $now->mon == 9
Truth table33%1/3
A && B
A= $now->mday == 2B= $now->mon == 9
ABresult
0X0
100
111
59 }
60  
61 sub ossan40 {
62 0 ▶ my @aa = (
Subroutine ossan40: not called CC=2 SCAR=17.9
Pod undocumented
63 <<'OPPAI'
64     _  ∩
65   ( ゜∀゜)彡 ${WORD}
66   (    | 
67    |   | 
68    し ⌒J
69  
70 contributed by @mattn_jp.
71 OPPAI
72 , <<'OPPAI'
73     _  ∩
74   ( ゜∀゜)彡 ${WORD}
75   (  ⊂彡
76    |   | 
77    し ⌒J
78  
79 contributed by @mattn_jp.
80 OPPAI
81 , <<'OPPAI'
82     _  
83   ( ゜∀゜)  ${WORD}
84   (  ⊂彡
85    |   | 
86    し ⌒J
87  
88 contributed by @mattn_jp.
89 OPPAI
90 );
91  
92 0 my $a;
93 0 for (1..5) {
94 0 $a = $aa[0]; $a =~ s!\${WORD}!おっ!!;
95 0 print "\e[2J$a"; sleep 0.1;
96 0 $a = $aa[1]; $a =~ s!\${WORD}!おっ!!;
97 0 print "\e[2J$a"; sleep 0.1;
98 0 $a = $aa[2]; $a =~ s!\${WORD}!おっ!!;
99 0 print "\e[2J$a"; sleep 0.5;
100  
101 0 $a = $aa[2]; $a =~ s!\${WORD}!おっさん!!;
102 0 print "\e[2J$a"; sleep 0.1;
103 0 $a = $aa[1]; $a =~ s!\${WORD}!おっさん!!;
104 0 print "\e[2J$a"; sleep 0.1;
105 0 $a = $aa[0]; $a =~ s!\${WORD}!おっさん!!;
106 0 print "\e[2J$a"; sleep 0.5;
107 }
108 }
109  
110 sub ossan41 {
111 0 ▶ my @aa = (
Subroutine ossan41: not called CC=2 SCAR=17.9
Pod undocumented
112 <<'OPPAI'
113   /⌒ヽ
114   ∩ ^ω^) な ん だ
115   |   ⊂ノ
116  |   _⊃
117   し ⌒
118  
119 contributed by @mattn_jp.
120 OPPAI
121 , <<'OPPAI'
122   /⌒ヽ
123  (^ω^ ∩ 4 1 か
124   t⊃  |
125  ⊂_   |
126    ⌒ J
127  
128 contributed by @mattn_jp.
129 OPPAI
130 , <<'OPPAI'
131      /⌒ヽ
132    (     )  おっおっおっ
133    /  、 つ
134   (_(__ ⌒)ノ
135    ∪ (ノ
136  
137 contributed by @mattn_jp.
138 OPPAI
139 );
140  
141 0 for (0..9) {
142 0 my $a = $aa[$_ % 3];
143 0 print "\e[2J$a"; sleep 1;
144 }
145 }
146  
147 2 ▶no Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
148 2 __PACKAGE__->meta->make_immutable();
149 __END__
↑ Summary blib/lib/Acme/Hidek/Congrats.pm »