Reply/Plugin/Autocomplete/Lexicals.pm

filter: Statementstmt 45.4% 15 / 33 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 31.7% 20 / 63 CC 11 SCAR 45.8
CC
11
Cov
28%
tab_handler
132.0
BEGIN
1.0
BEGIN
1.0
CRAP 97.1
« Reply/Plugin/Autocomplete/Globals.pm ↑ Summary Reply/Plugin/Autocomplete/Methods.pm »
1 package Reply::Plugin::Autocomplete::Lexicals;
2 1 our $AUTHORITY = 'cpan:DOY';
3 1 $Reply::Plugin::Autocomplete::Lexicals::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 lexical variables
7  
8 1 ▶use base 'Reply::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Reply::Util qw($varname_rx);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12  
13 0 ▶sub tab_handler {
Subroutine tab_handler: not called CC=11 SCAR=48.8
Pod documented
14 0 my $self = shift;
15 0 my ($line) = @_;
16  
17 0 my ($var) = $line =~ /($varname_rx)$/;
18 0 ▶ return unless $var;
Branch: 1 branch
BranchTrueFalseTotal
unless $var 0 0 0
19  
20 0 my ($sigil, $name_prefix) = $var =~ /(.)(.*)/;
21  
22 # these can't be lexicals
23 0 ▶ return if $sigil eq '&' || $sigil eq '*';
Branch: 1 branch
BranchTrueFalseTotal
if $sigil eq "&" or $sigil eq "*" 0 0 0
Condition0%0/3
$sigil eq "&" or $sigil eq "*"
l!l&&r!l&&!r
000
MC/DC0%0/2
$sigil eq "&" or $sigil eq "*"
$sigil eq "&" $sigil eq "*"
Truth table0%0/3
A or B
A= $sigil eq "&"B= $sigil eq "*"
ABresult
1X1
011
000
24  
25 0 my $env = { map { %$_ } $self->publish('lexical_environment') };
26 0 my @env = keys %$env;
27  
28 0 my @results;
29 0 for my $env_var (@env) {
30 0 my ($env_sigil, $env_name) = $env_var =~ /(.)(.*)/;
31  
32 0 ▶ next unless index($env_name, $name_prefix) == 0;
Branch: 1 branch
BranchTrueFalseTotal
unless index($env_name, $name_prefix) == 0 0 0 0
33  
34 # this is weird, not sure why % gets stripped but not $ or @
35 0 ▶ if ($sigil eq $env_sigil) {
Branch: 3 branches
BranchTrueFalseTotal
if ($sigil eq $env_sigil) { } 0 0 0
elsif ($env_sigil eq '@' and $sigil eq '$') { } 0 0 0
elsif ($env_sigil eq '%') { } 0 0 0
36 0 ▶ push @results, $sigil eq '%' ? $env_var : $env_name;
Branch: 1 branch
BranchTrueFalseTotal
$sigil eq '%' ? : 0 0 0
37 }
38 ▶ elsif ($env_sigil eq '@' && $sigil eq '$') {
Condition0%0/3
$env_sigil eq "\@" and $sigil eq "\$"
!ll&&!rl&&r
000
MC/DC0%0/2
$env_sigil eq "\@" and $sigil eq "\$"
$env_sigil eq "\@" $sigil eq "\$"
Truth table0%0/3
A and B
A= $env_sigil eq "\@"B= $sigil eq "\$"
ABresult
0X0
100
111
39 0 push @results, "$env_name\[";
40 }
41 elsif ($env_sigil eq '%') {
42 0 push @results, "$env_name\{";
43 }
44 }
45  
46 0 return @results;
47 }
48  
49 1 1;
50  
51 __END__
« Reply/Plugin/Autocomplete/Globals.pm ↑ Summary Reply/Plugin/Autocomplete/Methods.pm »