SyoboiCalendar/Title.pm

filter: Statementstmt 81.6% 49 / 60 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 82.3% 14 / 17 Podpod 0.0% 0 / 11 totaltotal 69.0% 67 / 97 CC 6 SCAR 9.4
CC
6
Cov
79%
BUILD
6.2
urls
2.0
official_site_url
2.0
CRAP 2.6
« SyoboiCalendar/API.pm ↑ Summary SyoboiCalendar.pm »
1 package WebService::SyoboiCalendar::Title;
2 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use Smart::Args;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Regexp::Common qw /URI/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 has api_result => (
9 is => 'rw',
10 );
11 has cast => (
12 is => 'rw',
13 1 ▶ default => sub { +{} },
Subroutine __ANON__: called CC=1 SCAR=0.0
14 2 );
15  
16 1 ▶sub BUILD {
Subroutine BUILD: called CC=6 SCAR=18.2
Pod undocumented
17 1 args_pos my $self, my $args;
18  
19 1 my @parts = split /\*/, $self->comment;
20  
21 1 for my $part (@parts) {
22 12 ▶ if ($part =~ m/キャスト/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($part =~ /\x{30ad}\x{30e3}\x{30b9}\x{30c8}/) 1 11 12
23 1 my $cast = {};
24 1 my @lines = (split /\r\n/, $part);
25 1 for my $line (@lines[1..$#lines]) {
26 11 my (undef, $character, $voice_actor) = split /:/, $line;
27 11 ▶ $cast->{$character} = $voice_actor if $character && $voice_actor;
Branch: 1 branch
BranchTrueFalseTotal
if $character and $voice_actor 11 0 11
Condition33%1/3
$character and $voice_actor
!ll&&!rl&&r
0011
MC/DC0%0/2
$character and $voice_actor
$character $voice_actor
Truth table33%1/3
A and B
A= $characterB= $voice_actor
ABresult
0X0
100
111
28 }
29 1 $self->cast($cast);
30 }
31 }
32 }
33  
34 1 ▶sub tid {
Subroutine tid: called CC=1 SCAR=0.0
Pod undocumented
35 1 args my $self;
36 1 $self->api_result->{TID};
37 }
38  
39 0 ▶sub urls {
Subroutine urls: not called CC=1 SCAR=6.9
Pod undocumented
40 0 args my $self;
41 0 my @urls = $self->api_result->{Comment} =~ m/$RE{URI}{HTTP}/g;
42 0 \@urls;
43 }
44  
45 0 ▶sub official_site_url {
Subroutine official_site_url: not called CC=1 SCAR=6.9
Pod undocumented
46 0 args my $self;
47 0 $self->urls->[0];
48 }
49  
50 1 ▶sub title {
Subroutine title: called CC=1 SCAR=0.0
Pod undocumented
51 1 args my $self;
52 1 $self->api_result->{Title};
53 }
54  
55 1 ▶sub sub_titles {
Subroutine sub_titles: called CC=1 SCAR=0.0
Pod undocumented
56 1 args my $self;
57 1 my $sub_titles = $self->api_result->{SubTitles};
58 1 $sub_titles =~ s/^\*\d+?\*//xmsg;
59 1 [split /\r\n/, $sub_titles];
60 }
61  
62 2 ▶sub characters {
Subroutine characters: called CC=1 SCAR=0.0
Pod undocumented
63 2 args my $self;
64 2 [sort { $a cmp $b } keys %{ $self->cast }];
65 }
66  
67 1 ▶sub voice_actors {
Subroutine voice_actors: called CC=1 SCAR=0.0
Pod undocumented
68 1 args my $self;
69 1 [map { $self->cast->{$_} } @{ $self->characters }];
70 }
71  
72 0 ▶sub find_cast {
Subroutine find_cast: not called CC=1 SCAR=6.9
Pod undocumented
73 0 args_pos my $self, my $character;
74  
75 0 my ($result) = map { $self->cast->{$_} } grep {
76 0 $_ =~ m/$character/;
77 0 } @{ $self->characters };
78 0 $result;
79 }
80  
81 2 ▶sub comment {
Subroutine comment: called CC=1 SCAR=0.0
Pod undocumented
82 2 args my $self;
83 2 $self->api_result->{Comment};
84 }
85  
86 1 ▶sub first_ch {
Subroutine first_ch: called CC=1 SCAR=0.0
Pod undocumented
87 1 args my $self;
88 1 $self->api_result->{FirstCh};
89 }
90  
91 2 1;
92  
93 =head1 NAME
94  
95 WebService::SyoboiCalendar::Title - Anime Title Object
96  
97 =head1 SYNOPSIS
98  
99 my $title = $result->title;
100  
101 $title->tid;
102 $title->urls;
103 $title->official_site_url;
104 $title->title;
105 $title->sub_titles;
106 $title->cast;
107 $title->characters;
108 $title->voice_actors;
109 $title->comment;
110 $title->first_ch;
111  
112 =head1 DESCRIPTION
113  
114 This object provides methods to access Anime Title information.
115 You can generate this from WebService::SyoboiCalendar::API::Result.
116  
117 =cut
« SyoboiCalendar/API.pm ↑ Summary SyoboiCalendar.pm »