5 use File::Temp qw(tempfile);
8 my $tmpfh = tempfile();
12 $truncate_status = truncate($tmpfh, 0);
15 if ($@ || !defined($truncate_status)) {
16 plan skip_all => 'Truncate not implemented or not working on this system';
22 my $can_truncate_stdout = truncate(\*STDOUT,0);
24 if ($can_truncate_stdout) {
25 skip("This system thinks we can truncate STDOUT. Suuure!", 1);
33 isa_ok($@, 'autodie::exception', "Truncating STDOUT should throw an exception");
43 isa_ok($@, 'autodie::exception', "Truncating an unopened file is wrong.");
45 $tmpfh->print("Hello World");
53 is($@, "", "Truncating a normal file should be fine");