RPC/API/AutoDiscover.pm

filter: Statementstmt 54.2% 19 / 35 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 1 totaltotal 51.0% 24 / 47 CC 4 SCAR 21.6
CC
4
Cov
49%
__ANON__
20.0
BUILD
2.0
BEGIN
1.0
CRAP 8.7
↑ Summary RPC/API/Command.pm »
1 package Neovim::RPC::API::AutoDiscover;
2 3 our $AUTHORITY = 'cpan:YANICK';
3 3 $Neovim::RPC::API::AutoDiscover::VERSION = '0.2.0';
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 with 'Neovim::RPC::API';
9  
10 3 ▶use Promises qw/ deferred /;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 3 ▶use experimental 'postderef';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 sub BUILD {
15 0 ▶ my $self = shift;
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
16
17 0 $self->add_command({ name => 'vim_get_api_info' });
18  
19 0 my $promise = deferred;
20  
21 $self->vim_get_api_info->done(sub {
22 0 ▶ my( $response ) = @_;
Subroutine __ANON__: not called CC=4 SCAR=30.0
23  
24 0 $self->channel_id( $response->[0] );
25  
26 0 my @funcs = $response->[1]{'functions'}->@*;
27  
28 0 for my $f ( @funcs ) {
29 0 ▶ next if $self->has_command( $f->{name} );
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_command($f->{"name"}) 0 0 0
30 0 $self->log( [ "adding function %s", $f->{name} ] );
31 0 $self->add_command( $f );
32 }
33  
34 0 ▶ while ( my ( $type, $val ) = each $response->[1]{'types'}->%* ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$$response[1]{"types"}}) 0 0 0
35 0 $self->types->{$type} = $val->{id};
36 }
37  
38 0 $self->vim_set_var( name => 'nvimx_channel', value => $self->channel_id );
39  
40 0 $promise->resolve;
41 0 } );
42  
43 0 $self->rpc->loop( $promise );
44 }
45  
46 3 1;
47  
48 __END__
49  
50 =pod
51  
52 =encoding UTF-8
53  
54 =head1 NAME
55  
56 Neovim::RPC::API::AutoDiscover
57  
58 =head1 VERSION
59  
60 version 0.2.0
61  
62 =head1 AUTHOR
63  
64 Yanick Champoux <yanick@cpan.org>
65  
66 =head1 COPYRIGHT AND LICENSE
67  
68 This software is copyright (c) 2015 by Yanick Champoux.
69  
70 This is free software; you can redistribute it and/or modify it under
71 the same terms as the Perl 5 programming language system itself.
72  
73 =cut
↑ Summary RPC/API/Command.pm »