dbMan/Extension/LineComplete.pm untested

filter: Statementstmt 0.0% 0 / 27 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 43 CC 4 SCAR 23.0
CC
4
Cov
0%
handle_action
20.0
IDENTIFICATION
2.0
preference
2.0
CRAP 10.0
1 package DBIx::dbMan::Extension::LineComplete;
2  
3 use strict;
4 use base 'DBIx::dbMan::Extension';
5  
6 our $VERSION = '0.03';
7  
8 1;
9  
10 sub IDENTIFICATION { return "000001-000048-000003"; }
11  
12 sub preference { return 3999; }
13  
14 sub known_actions { return [ qw/LINE_COMPLETE/ ]; }
15  
16 sub handle_action {
17 my ($obj,%action) = @_;
18  
19 if ($action{action} eq 'LINE_COMPLETE') {
20 $action{list} = [];
21 my %maybe = ();
22 for my $ext (@{$obj->{-core}->{extensions}}) {
23 if ($ext->can('cmdcomplete')) {
24 study "\Q$action{text}";
25 for ($ext->cmdcomplete($action{text},$action{line},$action{start})) {
26 ++$maybe{$_} if /^\Q$action{text}/i;
27 }
28 }
29 }
30 $action{list} = [ sort keys %maybe ];
31 $action{action} = 'NONE';
32 }
33 $action{processed} = 1;
34  
35 return %action;
36 }