Nepracujem s dynamickym polem z handleru signalu
[mirrors/Programs.git] / perl / fuse / fs2.pl
CommitLineData
21c4e167
H
1#!/usr/bin/env perl
2use Fuse::Simple qw(accessor main nocache saferun runcode);
3#use threads;
4#use threads::shared;
5
7685a4fd
H
6my $randfile = sub {
7 nocache $_[0]." ".rand(23)."\n";
8};
9
21c4e167
H
10
11my $randdir = sub {
12 my $list = {};
13 for(my $i=0;$i<int(rand(15));$i++) {
7685a4fd
H
14 #$list->{$i}="test #$i\n";
15 $list->{$i}=saferun($randfile, $i);
21c4e167
H
16 }
17 nocache $list;
18};
19
20my $var = "this is a variable you can modify. write to me!\n";
21my $filesystem = {
22 list => sub {
23 nocache("LOOOL:".rand(9999)."\n");
24 },
25 listing => $randdir,
26 foo => "this is the contents of a file called foo\n",
27 subdir => {
28 "foo" => "this foo is in a subdir called subdir\n",
29 "blah" => "this blah is in a subdir called subdir\n",
30 },
31 "blah" => \ "subdir/blah", # scalar refs are symlinks
32 recursion => {
33 "recursion" => \ ".", # scalar refs are symlinks
34 },
35 "magic" => sub { return "42\n" }, # will be called to get value
36 "var" => accessor(\$var), # read and write this variable
37 "var2" => accessor(\$var), # and the same variable
38 "var.b" => accessor(\ my $tmp), # and an anonymous var
39};
40
41print "mount....\n";
42main(
43 #"mountpoint" => "./test", # actually optional
44 "debug" => 0, # for debugging Fuse::Simple. optional
45 "fuse_debug" => 0, # for debugging FUSE itself. optional
46 "threaded" => 0, # optional
47 "/" => $filesystem, # required :-)
48);
49print "unmounted\n";
This page took 0.786126 seconds and 4 git commands to generate.