blib/lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Substitute_Subcmd/Path.pm untested

filter: Statementstmt 0.0% 0 / 52 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 71 CC 3 SCAR 14.2
CC
3
Cov
0%
run
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 4.1
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2013-2014 Rocky Bernstein <rocky@cpan.org>
3 use warnings; no warnings 'redefine'; no warnings 'once';
4 use rlib '../../../../../..';
5  
6 package Devel::Trepan::CmdProcessor::Command::Set::Substitute::Path;
7 use Devel::Trepan::DB::LineCache;
8  
9 use Devel::Trepan::CmdProcessor::Command::Subcmd::Subsubcmd;
10 use strict;
11 use vars qw(@ISA @SUBCMD_VARS);
12 @ISA = qw(Devel::Trepan::CmdProcessor::Command::Subsubcmd);
13  
14 # Values inherited from parent
15  
16 use vars @Devel::Trepan::CmdProcessor::Command::Subsubcmd::SUBCMD_VARS;
17 our $CMD = 'set display eval';
18 my @DISPLAY_TYPES = @Devel::Trepan::CmdProcessor::DISPLAY_TYPES;
19 my $param = join('|', @DISPLAY_TYPES);
20 =pod
21  
22 =head2 Synopsis:
23  
24 =cut
25 our $HELP = <<"HELP";
26 =pod
27  
28 B<set substitute path> [I<from-path>] I<to-path>
29  
30 Add a substitution rule replacing I<from-path> into I<to-path> in
31 source file names. If a substitution rule was previously set for
32 I<from-path>, the old rule is replaced by the new one. If I<from_path>
33 is not given use the current filename.
34  
35 =cut
36 HELP
37  
38 our $MIN_ABBREV = length('pa');
39 use constant MIN_ARGS => 1;
40 use constant MAX_ARGS => 2;
41 our $SHORT_HELP = 'Use PATH in place of a filename';
42  
43 sub run($$)
44 {
45 my ($self, $args) = @_;
46 my ($from_path, $to_path);
47 my $proc = $self->{proc};
48 if (scalar(@$args) == 5) {
49 $from_path = $args->[3];
50 $to_path = $args->[4];
51 } else {
52 $from_path = $proc->{frame}{file};
53 $to_path = $args->[3];
54 }
55 # FIXME: Check from_path name to see if it is loaded
56 if (-f $to_path) {
57 remap_file($from_path, $to_path);
58 } else {
59 $proc->errmsg("File ${to_path} doesn't exist");
60 }
61 }
62  
63 unless(caller) {
64 # requre File::Basename;
65 # Demo it.
66 # my $name = basename(__FILE__, '.pm')
67 }
68  
69 1;