File Coverage

lib/Devel/Trepan/CmdProcessor/Alias.pm
Criterion Covered Total %
statement 3 12 25.0
branch n/a
condition n/a
subroutine 1 3 33.3
pod 0 2 0.0
total 4 17 23.5


line stmt bran cond sub pod time code
1             # Copyright (C) 2012 Rocky Bernstein <rocky@cpan.org>
2             # Part of Trepan::CmdProcess that deails with alias routines
3 12     12   88 use rlib '../../..';
  12         31  
  12         94  
4              
5             package Devel::Trepan::CmdProcessor;
6              
7             sub add_alias($$$) {
8 0     0 0   my ($self, $command_name, $alias, $cmd_str) = @_;
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             sub remove_alias($$$) {
19 0     0 0   my ($self, $command_name, $alias) = @_;
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             1;