File: 08coreopen.t

package info (click to toggle)
libinline-files-perl 0.71-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 232 kB
  • sloc: perl: 617; xml: 12; makefile: 7
file content (60 lines) | stat: -rw-r--r-- 1,047 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# -*- cperl -*-
use lib qw(./blib/lib ../blib/lib);
use strict;
BEGIN { $| = 1; print "1..12\n"; }
use Inline::Files;

# 1..2
open X, ">out.tmp" or die;
print X "ok 2\n";
close X;
print "ok 1\n" if -f "out.tmp";
open Y, "out.tmp" or die;
print <Y>;
close Y;
unlink "out.tmp";

# 3..4
open X, ">", "out.tmp" or die;
print X "ok 4\n";
close X;
print "ok 3\n" if -f "out.tmp";
open Y, "<", "out.tmp" or die;
print <Y>;
close Y;
unlink "out.tmp";

# 5..7
open X, ">out.tmp" or die;
print X "ok 6\n";
close X;
print "ok 5\n" if -f "out.tmp";
open X, ">>out.tmp" or die;
print X "ok 7\n";
close X;
open Y, "out.tmp" or die;
print <Y>;
close Y;
unlink "out.tmp";

# 8..10
open X, ">","out.tmp" or die;
print X "ok 9\n";
close X;
print "ok 8\n" if -f "out.tmp";
open X, ">>","out.tmp" or die;
print X "ok 10\n";
close X;
open Y, "<out.tmp" or die;
print <Y>;
close Y;
unlink "out.tmp";

# 11..12
open X, qq{$^X -e "print 'ok 11'" | } or die "$!";
print <X>, "\n";
close X;
open X, "-|", qq{$^X -e "print 'ok 12'" } or die "$!";
print <X>, "\n";
close X;