Reply/Plugin/Autocomplete/Keywords.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 42 CC 6 SCAR 32.6
CC
6
Cov
0%
tab_handler
42.0
BEGIN
2.0
BEGIN
2.0
CRAP 26.0
1 package Reply::Plugin::Autocomplete::Keywords;
2 our $AUTHORITY = 'cpan:DOY';
3 $Reply::Plugin::Autocomplete::Keywords::VERSION = '0.42';
4 use strict;
5 use warnings;
6 # ABSTRACT: tab completion for perl keywords
7  
8 use base 'Reply::Plugin';
9  
10 use B::Keywords qw/@Functions @Barewords/;
11  
12  
13 sub tab_handler {
14 my $self = shift;
15 my ($line) = @_;
16  
17 my ($before, $last_word) = $line =~ /(.*?)(\w+)$/;
18 return unless $last_word;
19 return if $before =~ /^#/; # command
20 return if $before =~ /::$/; # Package::function call
21 return if $before =~ /->\s*$/; # method call
22 return if $before =~ /[\$\@\%\&\*]\s*$/;
23  
24 my $re = qr/^\Q$last_word/;
25  
26 return grep { $_ =~ $re } @Functions, @Barewords;
27 }
28  
29 1;
30  
31 __END__