+=head2 umount
+
+Unmount your database as filesystem.
+
+ $mnt->umount;
+
+This will also kill background process which is translating
+database to filesystem.
+
+=cut
+
+sub umount {
+ my $self = shift;
+
+ if ($self->{'mounted'}) {
+ system "fusermount -u ".$self->{'mount'} || warn "umount error: $!" && return 0;
+ }
+
+ return 1;
+}
+
+$SIG{'INT'} = sub {
+ print STDERR "umount called by SIG INT\n";
+ umount;
+};
+
+sub DESTROY {
+ my $self = shift;
+ return if (! $self->{'mounted'});
+ print STDERR "umount called by DESTROY\n";
+ $self->umount;
+}
+
+=head2 fuse_module_loaded
+
+Checks if C<fuse> module is loaded in kernel.
+
+ die "no fuse module loaded in kernel"
+ unless (Fuse::DBI::fuse_module_loaded);
+
+This function in called by C<mount>, but might be useful alone also.
+
+=cut
+
+sub fuse_module_loaded {
+ my $lsmod = `lsmod`;
+ die "can't start lsmod: $!" unless ($lsmod);
+ if ($lsmod =~ m/fuse/s) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+