File: demo_virtual.pl

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 (38 lines) | stat: -rwxr-xr-x 472 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
use Inline::Files::Virtual;

my @files = vf_load($0, "^__(?:FOO|BAR)__\n");

foreach $file (@files) {
	local *FILE;
	print "<<$file>>\n";
	vf_open FILE, $file or die "huh?";
	while (<FILE>) {
		print "> $_";
	}
}
print "<<<@files>>>\n";
print "<<<$files[0]>>>\n";

vf_open(FILE, "+> $files[0]");
print FILE "test";
vf_seek(FILE, 0, 0);
print <FILE>;




__END__
__FOO__
This is a
virtual


file
__BAR__
This is another
virtual

file
__FOO__
THIS IS YET ANOTHER SUCH
 FILE