lib/App/SocialSKK/Plugin/Eijiro.pm

filter: Statementstmt 68.7% 22 / 32 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 87.5% 7 / 8 Podpod 100% 1 / 1 totaltotal 62.5% 30 / 48 CC 4 SCAR 20.7
CC
4
Cov
58%
get_candidates
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 7.9
« lib/App/SocialSKK/Plugin/SocialIME.pm ↑ Summary lib/App/SocialSKK/Plugin/Wikipedia.pm »
1 package App::SocialSKK::Plugin::Eijiro;
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 URI::Escape;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Jcode;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use base qw(App::SocialSKK::Plugin);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 0 ▶sub get_candidates {
Subroutine get_candidates: not called CC=4 SCAR=30.0
Pod documented
11 0 my ($self, $text) = @_;
12 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
13  
14 0 $text = Jcode->new($text, 'euc')->utf8;
15 0 my $uri = URI->new('http://eowbeta.alc.co.jp/eow/sg/?q=');
16 0 $uri->query_param(q => $text);
17 0 my $res = $self->ua->get($uri);
18 0 ▶ if ($res->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res->is_success) 0 0 0
19 map {
20 0 my $word = uri_unescape($_);
21 0 Jcode->new($word, 'utf8')->euc;
22 } $res->content =~ m!<word>(.+?)</word>!g;
23 }
24 }
25  
26 1 1;
27  
28 __END__
29  
30 =head1 NAME
31  
32 App::SocialSKK::Plugin::Eijiro - Retrieves Candidates from Eijiro
33  
34 =head1 SYNOPSIS
35  
36 # Add a line like below into your .socialskk:
37 plugins:
38 - name: Eijiro
39  
40 =head1 DESCRIPTION
41  
42 App::SocialSKK::Plugin::Wikipedia performs retrieval of candidates
43 from Eijiro incremental search API.
44  
45 =head1 SEE ALSO
46  
47 =over 4
48  
49 =item * Eijiro
50  
51 http://eowbeta.alc.co.jp/
52  
53 =back
54  
55 =head1 AUTHOR
56  
57 Kentaro Kuribayashi E<lt>kentaro@cpan.orgE<gt>
« lib/App/SocialSKK/Plugin/SocialIME.pm ↑ Summary lib/App/SocialSKK/Plugin/Wikipedia.pm »