1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#!/usr/bin/perl
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require './test.pl';
}
use strict;
use warnings;
BEGIN {
if (!-c "/dev/null") {
print "1..0 # Skip: no /dev/null\n";
exit 0;
}
if (!-c "/dev/tty") {
print "1..0 # Skip: no /dev/tty\n";
exit 0;
}
}
plan(1);
sub rc {
open RC, ">", ".perldb" or die $!;
print RC @_;
close(RC);
# overly permissive perms gives "Must not source insecure rcfile"
# and hangs at the DB(1> prompt
chmod 0644, ".perldb";
}
my $target = '../lib/perl5db/t/eval-line-bug';
rc(
qq|
&parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
\n|,
qq|
sub afterinit {
push(\@DB::typeahead,
'b 23',
'n',
'n',
'n',
'c', # line 23
'n',
"p \\\@{'main::_<$target'}",
'q',
);
}\n|,
);
runperl(switches => [ '-d' ], progfile => $target);
my $contents;
{
local $/;
open I, "<", 'db.out' or die $!;
$contents = <I>;
close(I);
}
like($contents, qr/sub factorial/,
'The ${main::_<filename} variable in the debugger was not destroyed'
);
# clean up.
END {
unlink qw(.perldb db.out);
}
|