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