Commit | Line | Data |
---|---|---|
0b09a93a PF |
1 | package main; |
2 | use strict; | |
3 | use warnings; | |
4 | ||
273225d4 CBW |
5 | use constant NOFILE1 => 'this_file_had_better_not_exist'; |
6 | use constant NOFILE2 => NOFILE1 . '2'; | |
7 | use constant NOFILE3 => NOFILE1 . '3'; | |
8 | ||
0b09a93a PF |
9 | # Calls open, while still in the main package. This shouldn't |
10 | # be autodying. | |
11 | sub leak_test { | |
12 | return open(my $fh, '<', $_[0]); | |
13 | } | |
14 | ||
273225d4 CBW |
15 | # This rename shouldn't be autodying, either. |
16 | sub leak_test_rename { | |
17 | return rename($_[0], $_[1]); | |
18 | } | |
19 | ||
20 | # These are used by core-trampoline-slurp.t | |
21 | sub slurp_leak_unlink { | |
22 | unlink(NOFILE1, NOFILE2, NOFILE3); | |
23 | } | |
24 | ||
25 | sub slurp_leak_open { | |
26 | open(1,2,3,4,5); | |
27 | } | |
28 | ||
0b09a93a PF |
29 | package autodie_test_module; |
30 | ||
31 | # This should be calling CORE::open | |
32 | sub your_open { | |
33 | return open(my $fh, '<', $_[0]); | |
34 | } | |
35 | ||
273225d4 CBW |
36 | # This should be calling CORE::rename |
37 | sub your_rename { | |
38 | return rename($_[0], $_[1]); | |
39 | } | |
40 | ||
41 | sub your_dying_rename { | |
42 | use autodie qw(rename); | |
43 | return rename($_[0], $_[1]); | |
44 | } | |
45 | ||
0b09a93a | 46 | 1; |