RPC/Plugin/FileToPackageName.pm

filter: Statementstmt 60.0% 15 / 25 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 44.4% 4 / 9 Podpod 0.0% 0 / 2 totaltotal 52.7% 19 / 36 CC 1 SCAR 4.4
CC
1
Cov
60%
file_to_package_name
2.0
BUILD
2.0
__ANON__
2.0
CRAP 1.6
« RPC/API.pm ↑ Summary RPC/Plugin/LoadPlugin.pm »
1 package Neovim::RPC::Plugin::FileToPackageName;
2 1 our $AUTHORITY = 'cpan:YANICK';
3 1 $Neovim::RPC::Plugin::FileToPackageName::VERSION = '0.0.1';
4 1 ▶use 5.20.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 with 'Neovim::RPC::Plugin';
11  
12 sub file_to_package_name {
13 shift
14 0 ▶ =~ s#^(.*/)?lib/##r
Subroutine file_to_package_name: not called CC=1 SCAR=6.9
Pod undocumented
15 =~ s#^/##r
16 =~ s#/#::#rg
17 =~ s#\.p[ml]$##r;
18 }
19  
20 sub BUILD {
21 0 ▶ my $self = shift;
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
22  
23 $self->subscribe( 'file_to_package_name', sub {
24 0 ▶ my $msg = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
25  
26 my $y =
27 $self->api->vim_call_function( fname => 'expand', args => [ '%:p' ] )
28 ->then( sub {
29 0 ▶ $self->api->vim_set_current_line( line => 'package ' . file_to_package_name(shift) . ';' )
Subroutine __ANON__: not called CC=1 SCAR=6.9
30 0 });
31  
32 $y->on_done(sub{
33 0 ▶ my $z = $y; # to get around the silly 'weaken' bug
Subroutine __ANON__: not called CC=1 SCAR=6.9
34 0 $z = "foo";
35 0 $msg->done;
36 0 });
37  
38 0 });
39 }
40  
41 1 1;
42  
43 __END__
44  
45 =pod
46  
47 =encoding UTF-8
48  
49 =head1 NAME
50  
51 Neovim::RPC::Plugin::FileToPackageName
52  
53 =head1 VERSION
54  
55 version 0.0.1
56  
57 =head1 AUTHOR
58  
59 Yanick Champoux <yanick@cpan.org>
60  
61 =head1 COPYRIGHT AND LICENSE
62  
63 This software is copyright (c) 2015 by Yanick Champoux.
64  
65 This is free software; you can redistribute it and/or modify it under
66 the same terms as the Perl 5 programming language system itself.
67  
68 =cut
« RPC/API.pm ↑ Summary RPC/Plugin/LoadPlugin.pm »