Reply/Plugin/Autocomplete/Methods.pm

filter: Statementstmt 50.0% 18 / 36 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 83.3% 5 / 6 Podpod 100% 1 / 1 totaltotal 37.5% 24 / 64 CC 10 SCAR 43.0
CC
10
Cov
33%
tab_handler
110.0
BEGIN
1.0
BEGIN
1.0
CRAP 73.7
« Reply/Plugin/Autocomplete/Lexicals.pm ↑ Summary Reply/Plugin/ReadLine.pm »
1 package Reply::Plugin::Autocomplete::Methods;
2 1 our $AUTHORITY = 'cpan:DOY';
3 1 $Reply::Plugin::Autocomplete::Methods::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 methods
7  
8 1 ▶use base 'Reply::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Scalar::Util 'blessed';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Reply::Util qw($ident_rx $fq_ident_rx $fq_varname_rx methods);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14  
15 0 ▶sub tab_handler {
Subroutine tab_handler: not called CC=10 SCAR=47.0
Pod documented
16 0 my $self = shift;
17 0 my ($line) = @_;
18  
19 0 my ($invocant, $method_prefix) = $line =~ /($fq_varname_rx|$fq_ident_rx)->($ident_rx)?$/;
20 0 ▶ return unless $invocant;
Branch: 1 branch
BranchTrueFalseTotal
unless $invocant 0 0 0
21 # XXX unicode
22 0 ▶ return unless $invocant =~ /^[\$A-Z_a-z]/;
Branch: 1 branch
BranchTrueFalseTotal
unless $invocant =~ /^[\$A-Z_a-z]/ 0 0 0
23  
24 0 ▶ $method_prefix = '' unless defined $method_prefix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $method_prefix 0 0 0
25  
26 0 my $class;
27 0 ▶ if ($invocant =~ /^\$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($invocant =~ /^\$/) { } 0 0 0
28 # XXX should support globals here
29 my $env = {
30 0 map { %$_ } $self->publish('lexical_environment'),
31 };
32 0 my $var = $env->{$invocant};
33 0 ▶ return unless $var && ref($var) eq 'REF' && blessed($$var);
Branch: 1 branch
BranchTrueFalseTotal
unless $var and ref $var eq "REF" and builtin::blessed($$var) 0 0 0
Condition0%0/6
$var and ref $var eq "REF" and builtin::blessed($$var)
!ll&&!rl&&r
000
$var and ref $var eq "REF"
!ll&&!rl&&r
000
MC/DC0%0/3
$var and ref $var eq "REF" and builtin::blessed($$var)
$var ref $var eq "REF" builtin::blessed($$var)
Truth table0%0/4
A and B and C
A= $varB= ref $var eq "REF"C= builtin::blessed($$var)
ABCresult
0XX0
10X0
1100
1111
34 0 $class = blessed($$var);
35 }
36 else {
37 0 $class = $invocant;
38 }
39  
40 0 my @results;
41 0 for my $method (methods($class)) {
42 0 ▶ push @results, $method if index($method, $method_prefix) == 0;
Branch: 1 branch
BranchTrueFalseTotal
if index($method, $method_prefix) == 0 0 0 0
43 }
44  
45 0 return sort @results;
46 }
47  
48 1 1;
49  
50 __END__
« Reply/Plugin/Autocomplete/Lexicals.pm ↑ Summary Reply/Plugin/ReadLine.pm »