Linux cpanel2.daytoncreative.net 2.6.32-754.29.2.el6.x86_64 #1 SMP Tue May 12 17:39:04 UTC 2020 x86_64
Apache/2.4.43 (cPanel) OpenSSL/1.1.1g mod_bwlimited/1.4
Server IP : 70.62.220.67 & Your IP : 216.73.216.193
Domains :
Cant Read [ /etc/named.conf ]
User : michaelgreg
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
log /
perl-5.20.2 /
t /
op /
Delete
Unzip
Name
Size
Permission
Date
Action
64bitint.t
8.14
KB
-r--r--r--
2014-12-27 11:49
alarm.t
1.5
KB
-r--r--r--
2014-12-27 11:49
anonsub.t
1.7
KB
-r--r--r--
2014-12-27 11:49
append.t
1.58
KB
-r--r--r--
2014-12-27 11:49
args.t
2.12
KB
-r--r--r--
2014-12-27 11:49
array.t
12.32
KB
-r--r--r--
2014-12-27 11:49
array_base.t
720
B
-r--r--r--
2014-12-27 11:49
assignwarn.t
1.52
KB
-r--r--r--
2014-12-27 11:49
attrhand.t
1.01
KB
-r--r--r--
2014-12-27 11:49
attrproto.t
6.55
KB
-r--r--r--
2014-12-27 11:49
attrs.t
10.73
KB
-r--r--r--
2014-12-27 11:49
auto.t
2.36
KB
-r--r--r--
2014-12-27 11:49
avhv.t
4.04
KB
-r--r--r--
2014-12-27 11:49
bless.t
4.12
KB
-r--r--r--
2014-12-27 11:49
blocks.t
2.95
KB
-r--r--r--
2014-12-27 11:49
bop.t
12.82
KB
-r--r--r--
2014-12-27 11:49
caller.pl
3.75
KB
-r--r--r--
2014-12-27 11:49
caller.t
8.14
KB
-r--r--r--
2014-12-27 11:49
chars.t
1.73
KB
-r--r--r--
2014-12-27 11:49
chdir.t
6.68
KB
-r--r--r--
2014-12-27 11:49
chop.t
7.67
KB
-r--r--r--
2014-12-27 11:49
chr.t
2.48
KB
-r--r--r--
2014-12-27 11:49
closure.t
19.6
KB
-r--r--r--
2014-12-27 11:49
closure_test.pl
327
B
-r--r--r--
2014-12-27 11:49
concat2.t
1.41
KB
-r--r--r--
2014-12-27 11:49
cond.t
282
B
-r--r--r--
2014-12-27 11:49
context.t
404
B
-r--r--r--
2014-12-27 11:49
coreamp.t
29.17
KB
-r--r--r--
2014-12-27 11:49
coresubs.t
4.87
KB
-r--r--r--
2014-12-27 11:49
cproto.t
3.6
KB
-r--r--r--
2014-12-27 11:49
crypt.t
1.17
KB
-r--r--r--
2014-12-27 11:49
current_sub.t
1.71
KB
-r--r--r--
2014-12-27 11:49
dbm.t
1.54
KB
-r--r--r--
2014-12-27 11:49
defined.t
551
B
-r--r--r--
2014-12-27 11:49
defins.t
4.84
KB
-r--r--r--
2014-12-27 11:49
delete.t
2.93
KB
-r--r--r--
2014-12-27 11:49
die.t
1.99
KB
-r--r--r--
2014-12-27 11:49
die_except.t
1.57
KB
-r--r--r--
2014-12-27 11:49
die_exit.t
1.9
KB
-r--r--r--
2014-12-27 11:49
die_keeperr.t
1.57
KB
-r--r--r--
2014-12-27 11:49
die_unwind.t
1.69
KB
-r--r--r--
2014-12-27 11:49
do.t
8.35
KB
-r--r--r--
2014-12-27 11:49
dor.t
2.64
KB
-r--r--r--
2014-12-27 11:49
each.t
7.09
KB
-r--r--r--
2014-12-27 11:49
each_array.t
5.48
KB
-r--r--r--
2014-12-27 11:49
eval.t
13.92
KB
-r--r--r--
2014-12-27 11:49
evalbytes.t
989
B
-r--r--r--
2014-12-27 11:49
exec.t
4.36
KB
-r--r--r--
2014-12-27 11:49
exists_sub.t
2.09
KB
-r--r--r--
2014-12-27 11:49
exp.t
1.47
KB
-r--r--r--
2014-12-27 11:49
fh.t
790
B
-r--r--r--
2014-12-27 11:49
filehandle.t
564
B
-r--r--r--
2014-12-27 11:49
filetest.t
11.97
KB
-r--r--r--
2014-12-27 11:49
filetest_stack_ok.t
1.12
KB
-r--r--r--
2014-12-27 11:49
filetest_t.t
1.18
KB
-r--r--r--
2014-12-27 11:49
flip.t
868
B
-r--r--r--
2014-12-27 11:49
for.t
12.77
KB
-r--r--r--
2014-12-27 11:49
fork.t
8.8
KB
-r--r--r--
2014-12-27 11:49
fresh_perl_utf8.t
411
B
-r--r--r--
2014-12-27 11:49
getpid.t
1.61
KB
-r--r--r--
2014-12-27 11:49
getppid.t
3.13
KB
-r--r--r--
2014-12-27 11:49
glob.t
4.22
KB
-r--r--r--
2014-12-27 11:49
gmagic.t
5.97
KB
-r--r--r--
2014-12-27 11:49
goto.t
14.85
KB
-r--r--r--
2014-12-27 11:49
goto_xs.t
2.98
KB
-r--r--r--
2014-12-27 11:49
grent.t
4.46
KB
-r--r--r--
2014-12-27 11:49
grep.t
6.66
KB
-r--r--r--
2014-12-27 11:49
groups.t
11.15
KB
-r--r--r--
2014-12-27 11:49
gv.t
30.15
KB
-r--r--r--
2014-12-27 11:49
hash-rt85026.t
1.57
KB
-r--r--r--
2014-12-27 11:49
hash.t
6.02
KB
-r--r--r--
2014-12-27 11:49
hashassign.t
18.85
KB
-r--r--r--
2014-12-27 11:49
hashwarn.t
2.05
KB
-r--r--r--
2014-12-27 11:49
heredoc.t
2.29
KB
-r--r--r--
2014-12-27 11:49
inc.t
6.72
KB
-r--r--r--
2014-12-27 11:49
inccode-tie.t
338
B
-r--r--r--
2014-12-27 11:49
inccode.t
11.19
KB
-r--r--r--
2014-12-27 11:49
incfilter.t
7.33
KB
-r--r--r--
2014-12-27 11:49
index.t
6.81
KB
-r--r--r--
2014-12-27 11:49
index_thr.t
56
B
-r--r--r--
2014-12-27 11:49
int.t
1.72
KB
-r--r--r--
2014-12-27 11:49
join.t
3.2
KB
-r--r--r--
2014-12-27 11:49
kill0.t
3.18
KB
-r--r--r--
2014-12-27 11:49
kill0_child
596
B
-r--r--r--
2014-12-27 11:49
kvaslice.t
4.66
KB
-r--r--r--
2014-12-27 11:49
kvhslice.t
5.44
KB
-r--r--r--
2014-12-27 11:49
lc.t
11.8
KB
-r--r--r--
2014-12-27 11:49
leaky-magic.t
3.43
KB
-r--r--r--
2014-12-27 11:49
length.t
5.03
KB
-r--r--r--
2014-12-27 11:49
lex.t
2.33
KB
-r--r--r--
2014-12-27 11:49
lex_assign.t
7.17
KB
-r--r--r--
2014-12-27 11:49
lexsub.t
19.62
KB
-r--r--r--
2014-12-27 12:24
lfs.t
6.2
KB
-r--r--r--
2014-12-27 11:49
list.t
5.31
KB
-r--r--r--
2014-12-27 11:52
local.t
17.11
KB
-r--r--r--
2014-12-27 11:49
localref.t
2.73
KB
-r--r--r--
2014-12-27 11:49
lock.t
465
B
-r--r--r--
2014-12-27 11:49
loopctl.t
17.88
KB
-r--r--r--
2014-12-27 11:49
lop.t
1.2
KB
-r--r--r--
2014-12-27 11:49
magic-27839.t
622
B
-r--r--r--
2014-12-27 11:49
magic.t
21.81
KB
-r--r--r--
2014-12-27 11:49
method.t
18.91
KB
-r--r--r--
2014-12-27 11:49
mkdir.t
1.25
KB
-r--r--r--
2014-12-27 11:49
my.t
4.29
KB
-r--r--r--
2014-12-27 11:49
my_stash.t
769
B
-r--r--r--
2014-12-27 11:49
mydef.t
5.51
KB
-r--r--r--
2014-12-27 11:49
negate.t
4.3
KB
-r--r--r--
2014-12-27 11:49
not.t
3.15
KB
-r--r--r--
2014-12-27 11:49
numconvert.t
8.33
KB
-r--r--r--
2014-12-27 11:49
oct.t
3.58
KB
-r--r--r--
2014-12-27 11:49
or.t
1.79
KB
-r--r--r--
2014-12-27 11:49
ord.t
2.48
KB
-r--r--r--
2014-12-27 11:49
overload_integer.t
506
B
-r--r--r--
2014-12-27 11:49
override.t
4.33
KB
-r--r--r--
2014-12-27 11:49
pack.t
65.34
KB
-r--r--r--
2014-12-27 11:49
packagev.t
5.97
KB
-r--r--r--
2014-12-27 11:49
pos.t
3.59
KB
-r--r--r--
2014-12-27 11:49
postfixderef.t
11.97
KB
-r--r--r--
2014-12-27 11:49
pow.t
2.34
KB
-r--r--r--
2014-12-27 11:49
print.t
692
B
-r--r--r--
2014-12-27 11:49
protowarn.t
1.35
KB
-r--r--r--
2014-12-27 11:49
push.t
3.03
KB
-r--r--r--
2014-12-27 11:49
pwent.t
6.63
KB
-r--r--r--
2014-12-27 11:49
qr.t
2.32
KB
-r--r--r--
2014-12-27 11:49
quotemeta.t
5.61
KB
-r--r--r--
2014-12-27 11:49
rand.t
8.31
KB
-r--r--r--
2014-12-27 11:49
range.t
9.25
KB
-r--r--r--
2014-12-27 11:49
read.t
2.28
KB
-r--r--r--
2014-12-27 11:49
readdir.t
2.09
KB
-r--r--r--
2014-12-27 11:49
readline.t
7.19
KB
-r--r--r--
2014-12-27 11:49
recurse.t
2.73
KB
-r--r--r--
2014-12-27 11:49
ref.t
22.74
KB
-r--r--r--
2014-12-27 11:49
repeat.t
4.8
KB
-r--r--r--
2014-12-27 11:49
require_37033.t
1.18
KB
-r--r--r--
2014-12-27 11:49
require_errors.t
3.68
KB
-r--r--r--
2014-12-27 11:49
reset.t
5.41
KB
-r--r--r--
2014-12-27 11:49
reverse.t
3.01
KB
-r--r--r--
2014-12-27 11:49
rt119311.t
5.58
KB
-r--r--r--
2014-12-27 11:49
runlevel.t
5.28
KB
-r--r--r--
2014-12-27 11:49
select.t
1.03
KB
-r--r--r--
2014-12-27 11:49
setpgrpstack.t
378
B
-r--r--r--
2014-12-27 11:49
sigdispatch.t
4.33
KB
-r--r--r--
2014-12-27 11:49
signatures.t
41.02
KB
-r--r--r--
2014-12-27 11:49
sigsystem.t
1.36
KB
-r--r--r--
2014-12-27 11:49
sleep.t
468
B
-r--r--r--
2014-12-27 11:49
smartkve.t
18.26
KB
-r--r--r--
2014-12-27 11:49
smartmatch.t
10.34
KB
-r--r--r--
2014-12-27 11:49
sort.t
28.4
KB
-r--r--r--
2015-01-10 13:17
splice.t
3.38
KB
-r--r--r--
2014-12-27 11:49
split.t
13.1
KB
-r--r--r--
2014-12-27 11:49
split_unicode.t
2.4
KB
-r--r--r--
2014-12-27 11:49
sprintf.t
28.5
KB
-r--r--r--
2014-12-27 11:49
sprintf2.t
5.49
KB
-r--r--r--
2014-12-27 11:49
srand.t
1.87
KB
-r--r--r--
2014-12-27 11:49
sselect.t
2.67
KB
-r--r--r--
2014-12-27 11:49
stash.t
9.01
KB
-r--r--r--
2014-12-27 11:49
stat.t
17.51
KB
-r--r--r--
2014-12-27 11:49
state.t
9.72
KB
-r--r--r--
2014-12-27 12:15
study.t
2.99
KB
-r--r--r--
2014-12-27 11:49
studytied.t
1.29
KB
-r--r--r--
2014-12-27 11:49
sub.t
6.54
KB
-r--r--r--
2014-12-27 11:49
sub_lval.t
24.2
KB
-r--r--r--
2014-12-27 11:49
substr.t
20.53
KB
-r--r--r--
2014-12-27 11:49
substr_thr.t
56
B
-r--r--r--
2014-12-27 11:49
svleak.pl
6
B
-r--r--r--
2014-12-27 11:49
svleak.t
15.93
KB
-r--r--r--
2015-01-10 12:06
switch.t
28.06
KB
-r--r--r--
2014-12-27 11:49
symbolcache.t
1.06
KB
-r--r--r--
2014-12-27 11:49
sysio.t
5
KB
-r--r--r--
2014-12-27 11:49
taint.t
66.84
KB
-r--r--r--
2014-12-27 12:32
threads-dirh.t
3.47
KB
-r--r--r--
2014-12-27 11:49
threads.t
9.3
KB
-r--r--r--
2014-12-27 11:49
threads_create.pl
42
B
-r--r--r--
2014-12-27 11:49
tie.t
28.34
KB
-r--r--r--
2014-12-27 11:49
tie_fetch_count.t
11.49
KB
-r--r--r--
2014-12-27 11:49
tiearray.t
4.53
KB
-r--r--r--
2014-12-27 11:49
tiehandle.t
5.27
KB
-r--r--r--
2014-12-27 11:49
time.t
7.86
KB
-r--r--r--
2015-01-17 11:51
time_loop.t
378
B
-r--r--r--
2014-12-27 11:49
tr.t
12.99
KB
-r--r--r--
2014-12-27 11:49
undef.t
3.15
KB
-r--r--r--
2014-12-27 11:49
universal.t
8.32
KB
-r--r--r--
2014-12-27 11:49
unlink.t
1.02
KB
-r--r--r--
2014-12-27 11:49
unshift.t
3.17
KB
-r--r--r--
2014-12-27 11:49
upgrade.t
1.15
KB
-r--r--r--
2014-12-27 11:49
utf8cache.t
3.83
KB
-r--r--r--
2014-12-27 11:49
utf8decode.t
7.59
KB
-r--r--r--
2014-12-27 11:49
utf8magic.t
808
B
-r--r--r--
2014-12-27 11:49
utfhash.t
5.33
KB
-r--r--r--
2014-12-27 11:49
utftaint.t
4.46
KB
-r--r--r--
2014-12-27 11:49
vec.t
2.87
KB
-r--r--r--
2014-12-27 11:49
ver.t
8.39
KB
-r--r--r--
2014-12-27 11:49
waitpid.t
973
B
-r--r--r--
2014-12-27 11:49
wantarray.t
874
B
-r--r--r--
2014-12-27 11:49
warn.t
4.15
KB
-r--r--r--
2014-12-27 11:49
while.t
3.81
KB
-r--r--r--
2014-12-27 11:49
write.t
39.99
KB
-r--r--r--
2015-01-24 15:03
yadayada.t
1.67
KB
-r--r--r--
2015-01-15 22:12
Save
Rename
#!./perl BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; } plan(tests => 130); eval 'pass();'; is($@, ''); eval "\$foo\n = # this is a comment\n'ok 3';"; is($foo, 'ok 3'); eval "\$foo\n = # this is a comment\n'ok 4\n';"; is($foo, "ok 4\n"); print eval ' $foo =;'; # this tests for a call through yyerror() like($@, qr/line 2/); print eval '$foo = /'; # this tests for a call through fatal() like($@, qr/Search/); is scalar(eval '++'), undef, 'eval syntax error in scalar context'; is scalar(eval 'die'), undef, 'eval run-time error in scalar context'; is +()=eval '++', 0, 'eval syntax error in list context'; is +()=eval 'die', 0, 'eval run-time error in list context'; is(eval '"ok 7\n";', "ok 7\n"); $foo = 5; $fact = 'if ($foo <= 1) {1;} else {push(@x,$foo--); (eval $fact) * pop(@x);}'; $ans = eval $fact; is($ans, 120, 'calculate a factorial with recursive evals'); $foo = 5; $fact = 'local($foo)=$foo; $foo <= 1 ? 1 : $foo-- * (eval $fact);'; $ans = eval $fact; is($ans, 120, 'calculate a factorial with recursive evals'); my $curr_test = curr_test(); my $tempfile = tempfile(); open(try,'>',$tempfile); print try 'print "ok $curr_test\n";',"\n"; close try; do "./$tempfile"; print $@; # Test the singlequoted eval optimizer $i = $curr_test + 1; for (1..3) { eval 'print "ok ", $i++, "\n"'; } $curr_test += 4; eval { print "ok $curr_test\n"; die sprintf "ok %d\n", $curr_test + 2; 1; } || printf "ok %d\n$@", $curr_test + 1; curr_test($curr_test + 3); # check whether eval EXPR determines value of EXPR correctly { my @a = qw(a b c d); my @b = eval @a; is("@b", '4'); is($@, ''); my $a = q[defined(wantarray) ? (wantarray ? ($b='A') : ($b='S')) : ($b='V')]; my $b; @a = eval $a; is("@a", 'A'); is( $b, 'A'); $_ = eval $a; is( $b, 'S'); eval $a; is( $b, 'V'); $b = 'wrong'; $x = sub { my $b = "right"; is(eval('"$b"'), $b); }; &$x(); } { my $b = 'wrong'; my $X = sub { my $b = "right"; is(eval('"$b"'), $b); }; &$X(); } # check navigation of multiple eval boundaries to find lexicals my $x = 'aa'; eval <<'EOT'; die if $@; print "# $x\n"; # clone into eval's pad sub do_eval1 { eval $_[0]; die if $@; } EOT do_eval1('is($x, "aa")'); $x++; do_eval1('eval q[is($x, "ab")]'); $x++; do_eval1('sub { print "# $x\n"; eval q[is($x, "ac")] }->()'); $x++; # calls from within eval'' should clone outer lexicals eval <<'EOT'; die if $@; sub do_eval2 { eval $_[0]; die if $@; } do_eval2('is($x, "ad")'); $x++; do_eval2('eval q[is($x, "ae")]'); $x++; do_eval2('sub { print "# $x\n"; eval q[is($x, "af")] }->()'); EOT # calls outside eval'' should NOT clone lexicals from called context $main::ok = 'not ok'; my $ok = 'ok'; eval <<'EOT'; die if $@; # $x unbound here sub do_eval3 { eval $_[0]; die if $@; } EOT { my $ok = 'not ok'; do_eval3('is($ok, q{ok})'); do_eval3('eval q[is($ok, q{ok})]'); do_eval3('sub { eval q[is($ok, q{ok})] }->()'); } { my $x = curr_test(); my $got; sub recurse { my $l = shift; if ($l < $x) { ++$l; eval 'print "# level $l\n"; recurse($l);'; die if $@; } else { $got = "ok $l"; } } local $SIG{__WARN__} = sub { fail() if $_[0] =~ /^Deep recurs/ }; recurse(curr_test() - 5); is($got, "ok $x", "recursive subroutine-call inside eval'' see its own lexicals"); } eval <<'EOT'; sub create_closure { my $self = shift; return sub { return $self; }; } EOT is(create_closure("good")->(), "good", 'closures created within eval bind correctly'); $main::r = "good"; sub terminal { eval '$r . q{!}' } is(do { my $r = "bad"; eval 'terminal($r)'; }, 'good!', 'lexical search terminates correctly at subroutine boundary'); { # Have we cured panic which occurred with require/eval in die handler ? local $SIG{__DIE__} = sub { eval {1}; die shift }; eval { die "wham_eth\n" }; is($@, "wham_eth\n"); } { my $c = eval "(1,2)x10"; is($c, '2222222222', 'scalar eval"" pops stack correctly'); } # return from eval {} should clear $@ correctly { my $status = eval { eval { die }; print "# eval { return } test\n"; return; # removing this changes behavior }; is($@, '', 'return from eval {} should clear $@ correctly'); } # ditto for eval "" { my $status = eval q{ eval q{ die }; print "# eval q{ return } test\n"; return; # removing this changes behavior }; is($@, '', 'return from eval "" should clear $@ correctly'); } # Check that eval catches bad goto calls # (BUG ID 20010305.003) { eval { eval { goto foo; }; like($@, qr/Can't "goto" into the middle of a foreach loop/, 'eval catches bad goto calls'); last; foreach my $i (1) { foo: fail('jumped into foreach'); } }; fail("Outer eval didn't execute the last"); diag($@); } # Make sure that "my $$x" is forbidden # 20011224 MJD { foreach (qw($$x @$x %$x $$$x)) { eval 'my ' . $_; isnt($@, '', "my $_ is forbidden"); } } { $@ = 5; eval q{}; cmp_ok(length $@, '==', 0, '[ID 20020623.002] eval "" doesn\'t clear $@'); } # DAPM Nov-2002. Perl should now capture the full lexical context during # evals. $::zzz = $::zzz = 0; my $zzz = 1; eval q{ sub fred1 { eval q{ is(eval '$zzz', 1); } } fred1(47); { my $zzz = 2; fred1(48) } }; eval q{ sub fred2 { is(eval('$zzz'), 1); } }; fred2(49); { my $zzz = 2; fred2(50) } # sort() starts a new context stack. Make sure we can still find # the lexically enclosing sub sub do_sort { my $zzz = 2; my @a = sort { is(eval('$zzz'), 2); $a <=> $b } 2, 1; } do_sort(); # more recursion and lexical scope leak tests eval q{ my $r = -1; my $yyy = 9; sub fred3 { my $l = shift; my $r = -2; return 1 if $l < 1; return 0 if eval '$zzz' != 1; return 0 if $yyy != 9; return 0 if eval '$yyy' != 9; return 0 if eval '$l' != $l; return $l * fred3($l-1); } my $r = fred3(5); is($r, 120); $r = eval'fred3(5)'; is($r, 120); $r = 0; eval '$r = fred3(5)'; is($r, 120); $r = 0; { my $yyy = 4; my $zzz = 5; my $l = 6; $r = eval 'fred3(5)' }; is($r, 120); }; my $r = fred3(5); is($r, 120); $r = eval'fred3(5)'; is($r, 120); $r = 0; eval'$r = fred3(5)'; is($r, 120); $r = 0; { my $yyy = 4; my $zzz = 5; my $l = 6; $r = eval 'fred3(5)' }; is($r, 120); # check that goto &sub within evals doesn't leak lexical scope my $yyy = 2; sub fred4 { my $zzz = 3; is($zzz, 3); is(eval '$zzz', 3); is(eval '$yyy', 2); } eval q{ fred4(); sub fred5 { my $zzz = 4; is($zzz, 4); is(eval '$zzz', 4); is(eval '$yyy', 2); goto &fred4; } fred5(); }; fred5(); { my $yyy = 88; my $zzz = 99; fred5(); } eval q{ my $yyy = 888; my $zzz = 999; fred5(); }; { $eval = eval 'sub { eval "sub { %S }" }'; $eval->({}); pass('[perl #9728] used to dump core'); } # evals that appear in the DB package should see the lexical scope of the # thing outside DB that called them (usually the debugged code), rather # than the usual surrounding scope our $x = 1; { my $x=2; sub db1 { $x; eval '$x' } sub DB::db2 { $x; eval '$x' } package DB; sub db3 { eval '$x' } sub DB::db4 { eval '$x' } sub db5 { my $x=4; eval '$x' } package main; sub db6 { my $x=4; eval '$x' } } { my $x = 3; is(db1(), 2); is(DB::db2(), 2); is(DB::db3(), 3); is(DB::db4(), 3); is(DB::db5(), 3); is(db6(), 4); } # [perl #19022] used to end up with shared hash warnings # The program should generate no output, so anything we see is on stderr my $got = runperl (prog => '$h{a}=1; foreach my $k (keys %h) {eval qq{\$k}}', stderr => 1); is ($got, ''); # And a buggy way of fixing #19022 made this fail - $k became undef after the # eval for a build with copy on write { my %h; $h{a}=1; foreach my $k (keys %h) { is($k, 'a'); eval "\$k"; is($k, 'a'); } } sub Foo {} print Foo(eval {}); pass('#20798 (used to dump core)'); # check for context in string eval { my(@r,$r,$c); sub context { defined(wantarray) ? (wantarray ? ($c='A') : ($c='S')) : ($c='V') } my $code = q{ context() }; @r = qw( a b ); $r = 'ab'; @r = eval $code; is("@r$c", 'AA', 'string eval list context'); $r = eval $code; is("$r$c", 'SS', 'string eval scalar context'); eval $code; is("$c", 'V', 'string eval void context'); } # [perl #34682] escaping an eval with last could coredump or dup output $got = runperl ( prog => 'sub A::TIEARRAY { L: { eval { last L } } } tie @a, A; warn qq(ok\n)', stderr => 1); is($got, "ok\n", 'eval and last'); # eval undef should be the same as eval "" barring any warnings { local $@ = "foo"; eval undef; is($@, "", 'eval undef'); } { no warnings; eval "&& $b;"; like($@, qr/^syntax error/, 'eval syntax error, no warnings'); } # a syntax error in an eval called magically (eg via tie or overload) # resulted in an assertion failure in S_docatch, since doeval had already # popped the EVAL context due to the failure, but S_docatch expected the # context to still be there. { my $ok = 0; package Eval1; sub STORE { eval '('; $ok = 1 } sub TIESCALAR { bless [] } my $x; tie $x, bless []; $x = 1; ::is($ok, 1, 'eval docatch'); } # [perl #51370] eval { die "\x{a10d}" } followed by eval { 1 } did not reset # length $@ $@ = ""; eval { die "\x{a10d}"; }; $_ = length $@; eval { 1 }; cmp_ok($@, 'eq', "", 'length of $@ after eval'); cmp_ok(length $@, '==', 0, 'length of $@ after eval'); # Check if eval { 1 }; completely resets $@ SKIP: { skip_if_miniperl('no dynamic loading on miniperl, no Devel::Peek', 2); require Config; skip('Devel::Peek was not built', 2) unless $Config::Config{extensions} =~ /\bDevel\/Peek\b/; my $tempfile = tempfile(); open $prog, ">", $tempfile or die "Can't create test file"; print $prog <<'END_EVAL_TEST'; use Devel::Peek; $! = 0; $@ = $!; Dump($@); print STDERR "******\n"; eval { die "\x{a10d}"; }; $_ = length $@; eval { 1 }; Dump($@); print STDERR "******\n"; print STDERR "Done\n"; END_EVAL_TEST close $prog or die "Can't close $tempfile: $!"; my $got = runperl(progfile => $tempfile, stderr => 1); my ($first, $second, $tombstone) = split (/\*\*\*\*\*\*\n/, $got); is($tombstone, "Done\n", 'Program completed successfully'); $first =~ s/p?[NI]OK,//g; s/ PV = 0x[0-9a-f]+/ PV = 0x/ foreach $first, $second; s/ LEN = [0-9]+/ LEN = / foreach $first, $second; # Dump may double newlines through pipes, though not files # which is what this test used to use. $second =~ s/ IV = 0\n\n/ IV = 0\n/ if $^O eq 'VMS'; is($second, $first, 'eval { 1 } completely resets $@'); } # Test that "use feature" and other hint transmission in evals and s///ee # don't leak memory { use feature qw(:5.10); my $count_expected = ($^H & 0x20000) ? 2 : 1; my $t; my $s = "a"; $s =~ s/a/$t = \%^H; qq( qq() );/ee; is(Internals::SvREFCNT(%$t), $count_expected, 'RT 63110'); } { # test that the CV compiled for the eval is freed by checking that no additional # reference to outside lexicals are made. my $x; is(Internals::SvREFCNT($x), 1, "originally only 1 reference"); eval '$x'; is(Internals::SvREFCNT($x), 1, "execution eval doesn't create new references"); } fresh_perl_is(<<'EOP', "ok\n", undef, 'RT #70862'); $::{'@'}=''; eval {}; print "ok\n"; EOP fresh_perl_is(<<'EOP', "ok\n", undef, 'variant of RT #70862'); eval { $::{'@'}=''; }; print "ok\n"; EOP fresh_perl_is(<<'EOP', "ok\n", undef, 'related to RT #70862'); $::{'@'}=\3; eval {}; print "ok\n"; EOP fresh_perl_is(<<'EOP', "ok\n", undef, 'related to RT #70862'); eval { $::{'@'}=\3; }; print "ok\n"; EOP fresh_perl_is(<<'EOP', "ok\n", undef, 'segfault on syntax errors in block evals'); # localize the hits hash so the eval ends up with the pad offset of a copy of it in its targ BEGIN { $^H |= 0x00020000 } eval q{ eval { + } }; print "ok\n"; EOP fresh_perl_is(<<'EOP', "ok\n", undef, 'assert fail on non-string in Perl_lex_start'); use overload '""' => sub { '1;' }; my $ov = bless []; eval $ov; print "ok\n"; EOP for my $k (!0) { eval 'my $do_something_with = $k'; eval { $k = 'mon' }; is "a" =~ /a/, "1", "string eval leaves readonly lexicals readonly [perl #19135]"; } # [perl #68750] fresh_perl_is(<<'EOP', "ok\nok\nok\n", undef, 'eval clears %^H'); BEGIN { require re; re->import('/x'); # should only affect surrounding scope eval ' print "a b" =~ /a b/ ? "ok\n" : "nokay\n"; use re "/m"; print "a b" =~ /a b/ ? "ok\n" : "nokay\n"; '; } print "ab" =~ /a b/ ? "ok\n" : "nokay\n"; EOP # [perl #70151] { BEGIN { eval 'require re; import re "/x"' } ok "ab" =~ /a b/, 'eval does not localise %^H at run time'; } # The fix for perl #70151 caused an assertion failure that broke # SNMP::Trapinfo, when toke.c finds no syntax errors but perly.y fails. eval(q|""!=!~//|); pass("phew! dodged the assertion after a parsing (not lexing) error"); # [perl #111462] { local $ENV{PERL_DESTRUCT_LEVEL} = 1; unlike runperl( prog => 'BEGIN { $^H{foo} = bar }' .'our %FIELDS; my main $x; eval q[$x->{foo}]', stderr => 1, ), qr/Unbalanced string table/, 'Errors in finalize_optree do not leak string eval op tree'; } # [perl #114658] Line numbers at end of string eval for("{;", "{") { eval $_; is $@ =~ s/eval \d+/eval 1/rag, <<'EOE', Missing right curly or square bracket at (eval 1) line 1, at end of line syntax error at (eval 1) line 1, at EOF EOE qq'Right line number for eval "$_"'; } { my $w; local $SIG{__WARN__} = sub { $w .= shift }; eval "\${\nfoobar\n} = 10; warn q{should be line 3}"; is( $w =~ s/eval \d+/eval 1/ra, "should be line 3 at (eval 1) line 3.\n", 'eval qq{\${\nfoo\n}; warn} updates the line number correctly' ); } sub _117941 { package _117941; eval '$a' } delete $::{"_117941::"}; _117941(); pass("eval in freed package does not crash");