This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
new perldelta
[perl5.git] / cpan / autodie / t / autodie_test_module.pm
CommitLineData
0b09a93a
PF
1package main;
2use strict;
3use warnings;
4
273225d4
CBW
5use constant NOFILE1 => 'this_file_had_better_not_exist';
6use constant NOFILE2 => NOFILE1 . '2';
7use constant NOFILE3 => NOFILE1 . '3';
8
0b09a93a
PF
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
273225d4
CBW
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
0b09a93a
PF
29package autodie_test_module;
30
31# This should be calling CORE::open
32sub your_open {
33 return open(my $fh, '<', $_[0]);
34}
35
273225d4
CBW
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
0b09a93a 461;