Deprecate shellwords.pl with a warning
[p5sagit/p5-mst-13.2.git] / lib / autodie / t / string-eval-leak.t
CommitLineData
b0745470 1#!/usr/bin/perl -w
2use strict;
3use warnings;
4use Test::More tests => 2;
5
6# Under Perl 5.10.x, a string eval can cause a copy to be taken of
7# %^H, which delays stringification of our scope guard objects,
8# which in turn causes autodie to leak. These tests check to see
9# if we've successfully worked around this issue.
10
11eval {
12
13 {
14 use autodie;
15 eval "1";
16 }
17
18 open(my $fh, '<', 'this_file_had_better_not_exist');
19};
20
21TODO: {
22 local $TODO;
23
24 if ( $] >= 5.010 ) {
25 $TODO = "Autodie can leak near string evals in 5.10.x";
26 }
27
28 is("$@","","Autodie should not leak out of scope");
29}
30
31# However, we can plug the leak with 'no autodie'.
32
33no autodie;
34
35eval {
36 open(my $fh, '<', 'this_file_had_better_not_exist');
37};
38
39is("$@","",'no autodie should be able to workaround this bug');