line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
|
|
|
|
# Copyright (C) 2013-2014 Rocky Bernstein <rocky@cpan.org> |
3
|
12
|
|
|
12
|
|
88
|
use warnings; no warnings 'redefine'; no warnings 'once'; |
|
12
|
|
|
12
|
|
37
|
|
|
12
|
|
|
12
|
|
560
|
|
|
12
|
|
|
|
|
73
|
|
|
12
|
|
|
|
|
37
|
|
|
12
|
|
|
|
|
381
|
|
|
12
|
|
|
|
|
73
|
|
|
12
|
|
|
|
|
33
|
|
|
12
|
|
|
|
|
334
|
|
4
|
12
|
|
|
12
|
|
90
|
use rlib '../../../../../..'; |
|
12
|
|
|
|
|
33
|
|
|
12
|
|
|
|
|
84
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Devel::Trepan::CmdProcessor::Command::Set::Substitute::String; |
7
|
12
|
|
|
12
|
|
5538
|
use Devel::Trepan::DB::LineCache; |
|
12
|
|
|
|
|
36
|
|
|
12
|
|
|
|
|
2319
|
|
8
|
|
|
|
|
|
|
|
9
|
12
|
|
|
12
|
|
96
|
use Devel::Trepan::CmdProcessor::Command::Subcmd::Subsubcmd; |
|
12
|
|
|
|
|
39
|
|
|
12
|
|
|
|
|
337
|
|
10
|
12
|
|
|
12
|
|
74
|
use strict; |
|
12
|
|
|
|
|
38
|
|
|
12
|
|
|
|
|
345
|
|
11
|
12
|
|
|
12
|
|
66
|
use vars qw(@ISA @SUBCMD_VARS); |
|
12
|
|
|
|
|
31
|
|
|
12
|
|
|
|
|
866
|
|
12
|
|
|
|
|
|
|
@ISA = qw(Devel::Trepan::CmdProcessor::Command::Subsubcmd); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Values inherited from parent |
15
|
|
|
|
|
|
|
|
16
|
12
|
|
|
12
|
|
101
|
use vars @Devel::Trepan::CmdProcessor::Command::Subsubcmd::SUBCMD_VARS; |
|
12
|
|
|
|
|
36
|
|
|
12
|
|
|
|
|
1987
|
|
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 string> [I<from-file>] I<string> |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Use the contents of string variable I<string-var> as the source text for |
31
|
|
|
|
|
|
|
I<from-file>. If a substitution rule was previously set for |
32
|
|
|
|
|
|
|
I<from-file>, the old rule is replaced by the new one. If I<from_file> |
33
|
|
|
|
|
|
|
is not given use the current filename. |
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
HELP |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
our $MIN_ABBREV = length('st'); |
38
|
12
|
|
|
12
|
|
88
|
use constant MIN_ARGS => 1; |
|
12
|
|
|
|
|
35
|
|
|
12
|
|
|
|
|
696
|
|
39
|
12
|
|
|
12
|
|
79
|
use constant MAX_ARGS => 2; |
|
12
|
|
|
|
|
92
|
|
|
12
|
|
|
|
|
3127
|
|
40
|
|
|
|
|
|
|
our $SHORT_HELP = 'Use STRING in place of a filename'; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub run($$) |
43
|
|
|
|
|
|
|
{ |
44
|
0
|
|
|
0
|
|
|
my ($self, $args) = @_; |
45
|
0
|
|
|
|
|
|
my ($from_file, $string); |
46
|
0
|
|
|
|
|
|
my $proc = $self->{proc}; |
47
|
0
|
0
|
|
|
|
|
if (scalar(@$args) == 5) { |
48
|
0
|
|
|
|
|
|
$from_file = $args->[3]; |
49
|
0
|
|
|
|
|
|
$string = $args->[4]; |
50
|
|
|
|
|
|
|
} else { |
51
|
0
|
|
|
|
|
|
$from_file = $proc->{frame}{file}; |
52
|
0
|
|
|
|
|
|
$string = $args->[3]; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $opts = {return_type => '$', |
56
|
|
|
|
|
|
|
fix_file_and_line => 1, |
57
|
|
|
|
|
|
|
}; |
58
|
0
|
|
|
|
|
|
my $string_value = eval($string); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# FIXME: Check string name to see if it is loaded |
61
|
|
|
|
|
|
|
|
62
|
0
|
0
|
0
|
|
|
|
if (!$@ && defined($string_value)) { |
63
|
0
|
|
|
|
|
|
my $filename = remap_string_to_tempfile($string_value); |
64
|
0
|
|
|
|
|
|
remap_file($from_file, $filename); |
65
|
0
|
|
|
|
|
|
$proc->msg("Temporary file ${filename} with string contents created"); |
66
|
|
|
|
|
|
|
} else { |
67
|
0
|
|
|
|
|
|
$proc->errmsg("Can't get string value"); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
unless(caller) { |
72
|
|
|
|
|
|
|
# requre File::Basename; |
73
|
|
|
|
|
|
|
# Demo it. |
74
|
|
|
|
|
|
|
# my $name = basename(__FILE__, '.pm') |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |