Switching to `` requires one more \ to escape $Config in new_config=`...`
[p5sagit/p5-mst-13.2.git] / t / lib / autodie / scope_leak.t
1 #!/usr/bin/perl -w
2 use strict;
3 use FindBin;
4
5 # Check for %^H leaking across file boundries.  Many thanks
6 # to chocolateboy for pointing out this can be a problem.
7
8 use lib $FindBin::Bin;
9
10 use Test::More 'no_plan';
11
12 use constant NO_SUCH_FILE => 'this_file_had_better_not_exist';
13 use autodie qw(open);
14
15 eval {
16     open(my $fh, '<', NO_SUCH_FILE);
17 };
18
19 ok($@, "basic autodie test");
20
21 use autodie_test_module;
22
23 # If things don't work as they should, then the file we've
24 # just loaded will still have an autodying main::open (although
25 # its own open should be unaffected).
26
27 eval {
28     leak_test(NO_SUCH_FILE);
29 };
30
31 is($@,"","autodying main::open should not leak to other files");
32
33 eval {
34     autodie_test_module::your_open(NO_SUCH_FILE);
35 };
36
37 is($@,"","Other package open should be unaffected");