projects
/
Fuse-DBI
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
patch to fix current CVS version of Fuse perl bindings
[Fuse-DBI]
/
DBI.pm
diff --git
a/DBI.pm
b/DBI.pm
index
406db38
..
a70c24a
100755
(executable)
--- a/
DBI.pm
+++ b/
DBI.pm
@@
-13,7
+13,7
@@
use Carp;
use Data::Dumper;
use Data::Dumper;
-our $VERSION = '0.0
4
';
+our $VERSION = '0.0
5
';
=head1 NAME
=head1 NAME
@@
-29,7
+29,7
@@
See C<run> below for examples how to set parameters.
=head1 DESCRIPTION
This module will use C<Fuse> module, part of C<FUSE (Filesystem in USErspace)>
=head1 DESCRIPTION
This module will use C<Fuse> module, part of C<FUSE (Filesystem in USErspace)>
-available at L<http://
sourceforge.net/projects/avf
> to mount
+available at L<http://
fuse.sourceforge.net/
> to mount
your database as file system.
That will give you possibility to use normal file-system tools (cat, grep, vi)
your database as file system.
That will give you possibility to use normal file-system tools (cat, grep, vi)
@@
-148,6
+148,7
@@
sub mount {
my $pid;
if ($arg->{'fork'}) {
my $pid;
if ($arg->{'fork'}) {
+ $self->{'mounted'} = 1;
$pid = fork();
die "fork() failed: $!" unless defined $pid;
# child will return to caller
$pid = fork();
die "fork() failed: $!" unless defined $pid;
# child will return to caller
@@
-169,7
+170,7
@@
sub mount {
$self->{'read_filenames'} = sub { $self->read_filenames };
$self->read_filenames;
$self->{'read_filenames'} = sub { $self->read_filenames };
$self->read_filenames;
- $self->{'mounted'} = 1;
+ $self->{'mounted'} = 1
unless ($arg->{'fork'})
;
$fuse_self = \$self;
$fuse_self = \$self;
@@
-211,7
+212,7
@@
sub umount {
my $self = shift;
if ($self->{'mounted'}) {
my $self = shift;
if ($self->{'mounted'}) {
- system "fusermount -u ".$self->{'mount'} ||
croak "umount error: $!"
;
+ system "fusermount -u ".$self->{'mount'} ||
warn "umount error: $!" && return 0
;
}
return 1;
}
return 1;
@@
-342,7
+343,7
@@
sub e_getdir {
my %out;
foreach my $f (sort keys %files) {
if ($dirname) {
my %out;
foreach my $f (sort keys %files) {
if ($dirname) {
- if ($f =~ s/^\
E$dirname\Q
\///) {
+ if ($f =~ s/^\
Q$dirname\E
\///) {
$out{$f}++ if ($f =~ /^[^\/]+$/);
}
} else {
$out{$f}++ if ($f =~ /^[^\/]+$/);
}
} else {
@@
-364,7
+365,8
@@
sub read_content {
$sth->{'read'}->execute($id) || die $sth->{'read'}->errstr;
$files{$file}{cont} = $sth->{'read'}->fetchrow_array;
$sth->{'read'}->execute($id) || die $sth->{'read'}->errstr;
$files{$file}{cont} = $sth->{'read'}->fetchrow_array;
- $files{$file}{ctime} = time();
+ # I should modify ctime only if content in database changed
+ #$files{$file}{ctime} = time() unless ($files{$file}{ctime});
print "file '$file' content [",length($files{$file}{cont})," bytes] read in cache\n";
}
print "file '$file' content [",length($files{$file}{cont})," bytes] read in cache\n";
}
@@
-410,6
+412,7
@@
sub clear_cont {
print "invalidate all cached content\n";
foreach my $f (keys %files) {
delete $files{$f}{cont};
print "invalidate all cached content\n";
foreach my $f (keys %files) {
delete $files{$f}{cont};
+ delete $files{$f}{ctime};
}
print "begin new transaction\n";
#$dbh->begin_work || die $dbh->errstr;
}
print "begin new transaction\n";
#$dbh->begin_work || die $dbh->errstr;
@@
-521,10
+524,10
@@
Nothing.
=head1 SEE ALSO
C<FUSE (Filesystem in USErspace)> website
=head1 SEE ALSO
C<FUSE (Filesystem in USErspace)> website
-L<http://
sourceforge.net/projects/avf
>
+L<http://
fuse.sourceforge.net/
>
Example for WebGUI which comes with this distribution in
Example for WebGUI which comes with this distribution in
-directory
L
<examples/webgui.pl>. It also contains a lot of documentation
+directory
C
<examples/webgui.pl>. It also contains a lot of documentation
about design of this module, usage and limitations.
=head1 AUTHOR
about design of this module, usage and limitations.
=head1 AUTHOR