File: demo_persistence.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 (22 lines) | stat: -rwxr-xr-x 400 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
use Inline::Files;

open CACHE or die $!;	# read access (uses $CACHE to locate file)
eval join "", <CACHE>;
close CACHE or die $!;

print "\$var was '$var'\n";

while (<>) {
	chomp;
	$var = $_;
	print "\$var now '$var'\n";
}

open CACHE, ">$CACHE" or die $!;	# write access
use Data::Dumper;
print CACHE Data::Dumper->Dump([$var],['var']);
close CACHE or die $!;

__CACHE__
$var = 'Original value';