Reply/Plugin/Autocomplete/Functions.pm

filter: Statementstmt 52.9% 18 / 34 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 100% 1 / 1 totaltotal 45.2% 24 / 53 CC 7 SCAR 35.0
CC
7
Cov
39%
tab_handler
56.0
BEGIN
1.0
BEGIN
1.0
CRAP 33.1
« Reply/App.pm ↑ Summary Reply/Plugin/Autocomplete/Keywords.pm »
1 package Reply::Plugin::Autocomplete::Functions;
2 1 our $AUTHORITY = 'cpan:DOY';
3 1 $Reply::Plugin::Autocomplete::Functions::VERSION = '0.42';
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 # ABSTRACT: tab completion for function names
7  
8 1 ▶use base 'Reply::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Module::Runtime '$module_name_rx';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Package::Stash;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13  
14 0 ▶sub tab_handler {
Subroutine tab_handler: not called CC=7 SCAR=40.3
Pod documented
15 0 my $self = shift;
16 0 my ($line) = @_;
17  
18 0 my ($before, $fragment) = $line =~ /(.*?)(${module_name_rx}(::)?)$/;
19 0 ▶ return unless $fragment;
Branch: 1 branch
BranchTrueFalseTotal
unless $fragment 0 0 0
20 0 ▶ return if $before =~ /^#/; # commands
Branch: 1 branch
BranchTrueFalseTotal
if $before =~ /^#/ 0 0 0
21  
22 0 my $current_package = ($self->publish('package'))[-1];
23  
24 0 my ($package, $func);
25 0 ▶ if ($fragment =~ /:/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fragment =~ /:/) { } 0 0 0
26 0 ($package, $func) = ($fragment =~ /^(.+:)(\w*)$/);
27 0 ▶ $func = '' unless defined $func;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $func 0 0 0
28 0 $package =~ s/:{1,2}$//;
29 }
30 else {
31 0 $package = $current_package;
32 0 $func = $fragment;
33 }
34  
35 return
36 0 ▶ map { $package eq $current_package ? $_ : "$package\::$_" }
Branch: 1 branch
BranchTrueFalseTotal
$package eq $current_package ? : 0 0 0
37 0 ▶ grep { $func ? /^\Q$func/ : 1 }
Branch: 1 branch
BranchTrueFalseTotal
$func ? : 0 0 0
38 'Package::Stash'->new($package)->list_all_symbols('CODE');
39 }
40  
41 1 1;
42  
43 __END__
« Reply/App.pm ↑ Summary Reply/Plugin/Autocomplete/Keywords.pm »