lib/Devel/Trepan/CmdProcessor/Alias.pm

filter: Statementstmt 18.1% 4 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 20.0% 1 / 5 Podpod 0.0% 0 / 4 totaltotal 16.1% 5 / 31 CC 1 SCAR 5.9
CC
1
Cov
18%
add_alias
2.0
add_alias
2.0
remove_alias
2.0
CRAP 1.8
« example/lsub.pl ↑ Summary lib/Devel/Trepan/CmdProcessor/Command/Run.pm »
1 # Copyright (C) 2012 Rocky Bernstein <rocky@cpan.org>
2 # Part of Trepan::CmdProcess that deails with alias routines
3 12 ▶use rlib '../../..';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Devel::Trepan::CmdProcessor;
6  
7 0 ▶sub add_alias($$$) {
Subroutine add_alias: not called CC=1 SCAR=6.9
Pod undocumented
8 0 ▶ my ($self, $command_name, $alias, $cmd_str) = @_;
Subroutine add_alias: not called CC=1 SCAR=6.9
Pod undocumented
9  
10 # Update array inside command name
11 0 my $cmd_alias_ref = $self->{commands}{$command_name}{aliases};
12 0 push @$cmd_alias_ref, $alias;
13  
14 # Upate aliases hash
15 0 $self->{aliases}{$alias} = $cmd_str;
16 }
17  
18 0 ▶sub remove_alias($$$) {
Subroutine remove_alias: not called CC=1 SCAR=6.9
Pod undocumented
19 0 ▶ my ($self, $command_name, $alias) = @_;
Subroutine remove_alias: not called CC=1 SCAR=6.9
Pod undocumented
20  
21 # Update array inside command name
22 0 my $cmd_alias_ref = $self->{commands}{$command_name}{aliases};
23 0 my @new_aliases = grep(($alias ne $_), @$cmd_alias_ref);
24 0 $self->{commands}{$command_name}{aliases} = \@new_aliases;
25
26 # Upate aliases hash
27 0 delete $self->{aliases}{$alias};
28 }
29  
30 12 1;
« example/lsub.pl ↑ Summary lib/Devel/Trepan/CmdProcessor/Command/Run.pm »