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