13 |
use Data::Dumper; |
use Data::Dumper; |
14 |
|
|
15 |
|
|
16 |
our $VERSION = '0.04'; |
our $VERSION = '0.06'; |
17 |
|
|
18 |
=head1 NAME |
=head1 NAME |
19 |
|
|
29 |
=head1 DESCRIPTION |
=head1 DESCRIPTION |
30 |
|
|
31 |
This module will use C<Fuse> module, part of C<FUSE (Filesystem in USErspace)> |
This module will use C<Fuse> module, part of C<FUSE (Filesystem in USErspace)> |
32 |
available at L<http://sourceforge.net/projects/avf> to mount |
available at L<http://fuse.sourceforge.net/> to mount |
33 |
your database as file system. |
your database as file system. |
34 |
|
|
35 |
That will give you possibility to use normal file-system tools (cat, grep, vi) |
That will give you possibility to use normal file-system tools (cat, grep, vi) |
169 |
$self->{'read_filenames'} = sub { $self->read_filenames }; |
$self->{'read_filenames'} = sub { $self->read_filenames }; |
170 |
$self->read_filenames; |
$self->read_filenames; |
171 |
|
|
|
$self->{'mounted'} = 1; |
|
|
|
|
172 |
$fuse_self = \$self; |
$fuse_self = \$self; |
173 |
|
|
174 |
Fuse::main( |
Fuse::main( |
186 |
debug=>0, |
debug=>0, |
187 |
); |
); |
188 |
|
|
|
$self->{'mounted'} = 0; |
|
|
|
|
189 |
exit(0) if ($arg->{'fork'}); |
exit(0) if ($arg->{'fork'}); |
190 |
|
|
191 |
return 1; |
return 1; |
206 |
sub umount { |
sub umount { |
207 |
my $self = shift; |
my $self = shift; |
208 |
|
|
209 |
if ($self->{'mounted'}) { |
if ($self->{'mount'}) { |
210 |
system "fusermount -u ".$self->{'mount'} || croak "umount error: $!"; |
if (open(MTAB, "/etc/mtab")) { |
211 |
} |
my $mounted = 0; |
212 |
|
my $mount = $self->{'mount'}; |
213 |
|
while(<MTAB>) { |
214 |
|
$mounted = 1 if (/ $mount fuse /i); |
215 |
|
} |
216 |
|
close(MTAB); |
217 |
|
|
218 |
|
if ($mounted) { |
219 |
|
system "fusermount -u ".$self->{'mount'}." 2>&1 >/dev/null" || return 0; |
220 |
|
return 1; |
221 |
|
} |
222 |
|
|
223 |
return 1; |
} else { |
224 |
|
warn "can't open /etc/mtab: $!"; |
225 |
|
return 0; |
226 |
|
} |
227 |
|
} |
228 |
} |
} |
229 |
|
|
230 |
$SIG{'INT'} = sub { |
$SIG{'INT'} = sub { |
231 |
print STDERR "umount called by SIG INT\n"; |
if ($fuse_self && $$fuse_self->umount) { |
232 |
umount; |
print STDERR "umount called by SIG INT\n"; |
233 |
|
} |
234 |
|
}; |
235 |
|
|
236 |
|
$SIG{'QUIT'} = sub { |
237 |
|
if ($fuse_self && $$fuse_self->umount) { |
238 |
|
print STDERR "umount called by SIG QUIT\n"; |
239 |
|
} |
240 |
}; |
}; |
241 |
|
|
242 |
sub DESTROY { |
sub DESTROY { |
243 |
my $self = shift; |
my $self = shift; |
244 |
return if (! $self->{'mounted'}); |
if ($self->umount) { |
245 |
print STDERR "umount called by DESTROY\n"; |
print STDERR "umount called by DESTROY\n"; |
246 |
$self->umount; |
} |
247 |
} |
} |
248 |
|
|
249 |
=head2 fuse_module_loaded |
=head2 fuse_module_loaded |
281 |
type => 0040, |
type => 0040, |
282 |
mode => 0755, |
mode => 0755, |
283 |
}, |
}, |
284 |
|
'..' => { |
285 |
|
type => 0040, |
286 |
|
mode => 0755, |
287 |
|
}, |
288 |
# a => { |
# a => { |
289 |
# cont => "File 'a'.\n", |
# cont => "File 'a'.\n", |
290 |
# type => 0100, |
# type => 0100, |
541 |
|
|
542 |
Nothing. |
Nothing. |
543 |
|
|
544 |
|
=head1 BUGS |
545 |
|
|
546 |
|
Size information (C<ls -s>) is wrong. It's a problem in upstream Fuse module |
547 |
|
(for which I'm to blame lately), so when it gets fixes, C<Fuse::DBI> will |
548 |
|
automagically pick it up. |
549 |
|
|
550 |
=head1 SEE ALSO |
=head1 SEE ALSO |
551 |
|
|
552 |
C<FUSE (Filesystem in USErspace)> website |
C<FUSE (Filesystem in USErspace)> website |
553 |
L<http://sourceforge.net/projects/avf> |
L<http://fuse.sourceforge.net/> |
554 |
|
|
555 |
Example for WebGUI which comes with this distribution in |
Example for WebGUI which comes with this distribution in |
556 |
directory C<examples/webgui.pl>. It also contains a lot of documentation |
directory C<examples/webgui.pl>. It also contains a lot of documentation |