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