lib/App/SocialSKK/Plugin/SocialIME.pm

filter: Statementstmt 61.5% 16 / 26 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 83.3% 5 / 6 Podpod 100% 1 / 1 totaltotal 55.0% 22 / 40 CC 4 SCAR 22.5
CC
4
Cov
50%
get_candidates
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 9.4
↑ Summary lib/App/SocialSKK/Plugin/Eijiro.pm »
1 package App::SocialSKK::Plugin::SocialIME;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use URI::QueryParam;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use base qw(App::SocialSKK::Plugin);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub get_candidates {
Subroutine get_candidates: not called CC=4 SCAR=30.0
Pod documented
9 0 my ($self, $text) = @_;
10 0 ▶ return if ($text || '') eq '';
Branch: 1 branch
BranchTrueFalseTotal
if ($text || "") eq "" 0 0 0
Condition0%0/2
$text || ''
l!l
00
MC/DC0%0/1
$text || ''
$text
Truth table0%0/2
A
A= $text
Aresult
11
00
11  
12 0 my $uri = URI->new('http://www.social-ime.com/api/');
13 0 $uri->query_param(string => $text);
14 0 my $res = $self->ua->get($uri);
15 0 ▶ if ($res->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res->is_success) 0 0 0
16 0 map { s|\s*$||smg; $_ } grep { $_ !~ /^\s*$/ } split /\t/, $res->content;
17 }
18 }
19  
20 1 1;
21  
22 __END__
23  
24 =head1 NAME
25  
26 App::SocialSKK::Plugin::SocialIME - Retrieves Candidates from Social
27 IME
28  
29 =head1 SYNOPSIS
30  
31 # Add a line like below into your .socialskk:
32 plugins:
33 - name: SocialIME
34  
35 =head1 DESCRIPTION
36  
37 App::SocialSKK::Plugin::SocialIME performs retrieval of candidates
38 from Social IME. This plugin will be used by default in socialskk.pl
39 without any configuration in .socialskk.
40  
41 =head1 SEE ALSO
42  
43 =over 4
44  
45 =item * Social IME
46  
47 http://www.social-ime.com/
48  
49 =back
50  
51 =head1 AUTHOR
52  
53 Kentaro Kuribayashi E<lt>kentaro@cpan.orgE<gt>
↑ Summary lib/App/SocialSKK/Plugin/Eijiro.pm »