/[fuse_dbi]/trunk/DBI.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/DBI.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 11 by dpavlin, Sun Aug 29 18:51:29 2004 UTC revision 13 by dpavlin, Sun Aug 29 20:12:37 2004 UTC
# Line 76  sub mount { Line 76  sub mount {
76          carp "mount needs 'dsn' to connect to (e.g. dsn => 'DBI:Pg:dbname=test')" unless ($arg->{'dsn'});          carp "mount needs 'dsn' to connect to (e.g. dsn => 'DBI:Pg:dbname=test')" unless ($arg->{'dsn'});
77          carp "mount needs 'mount' as mountpoint" unless ($arg->{'mount'});          carp "mount needs 'mount' as mountpoint" unless ($arg->{'mount'});
78    
79            # save (some) arguments in self
80            $self->{$_} = $arg->{$_} foreach (qw(mount));
81    
82          foreach (qw(filenames read update)) {          foreach (qw(filenames read update)) {
83                  carp "mount needs '$_' SQL" unless ($arg->{$_});                  carp "mount needs '$_' SQL" unless ($arg->{$_});
84          }          }
# Line 112  sub mount { Line 115  sub mount {
115                  );                  );
116          } );          } );
117    
118            confess "Fuse::main failed" if (! $self->{'proc'}->poll);
119    
120          $self ? return $self : return undef;          $self ? return $self : return undef;
121  };  };
122    
# Line 130  sub umount { Line 135  sub umount {
135          my $self = shift;          my $self = shift;
136    
137          confess "no process running?" unless ($self->{'proc'});          confess "no process running?" unless ($self->{'proc'});
138          $self->{'proc'}->kill;  
139            system "fusermount -u ".$self->{'mount'} || croak "umount error: $!";
140    
141            if ($self->{'proc'}->poll) {
142                    $self->{'proc'}->kill;
143                    return 1 if (! $self->{'proc'}->poll);
144            } else {
145                    return 1;
146            }
147  }  }
148    
149    
# Line 222  sub e_getdir { Line 235  sub e_getdir {
235          # return as many text filenames as you like, followed by the retval.          # return as many text filenames as you like, followed by the retval.
236          print((scalar keys %files)." files total\n");          print((scalar keys %files)." files total\n");
237          my %out;          my %out;
238          foreach (keys %files) {          foreach my $f (sort keys %files) {
                 my $f = $_;  
                 $f =~ s/^\E$dirname\Q//;  
                 $f =~ s/^\///;  
239                  if ($dirname) {                  if ($dirname) {
240                          $out{$f}++ if (/^\E$dirname\Q/ && $f =~ /^[^\/]+$/);                          if ($f =~ s/^\E$dirname\Q\///) {
241                                    $out{$f}++ if ($f =~ /^[^\/]+$/);
242                            }
243                  } else {                  } else {
244                          $out{$f}++ if ($f =~ /^[^\/]+$/);                          $out{$f}++ if ($f =~ /^[^\/]+$/);
245                  }                  }
# Line 236  sub e_getdir { Line 248  sub e_getdir {
248                  $out{'no files? bug?'}++;                  $out{'no files? bug?'}++;
249          }          }
250          print scalar keys %out," files in dir '$dirname'\n";          print scalar keys %out," files in dir '$dirname'\n";
251            print "## ",join(" ",keys %out),"\n";
252          return (keys %out),0;          return (keys %out),0;
253  }  }
254    

Legend:
Removed from v.11  
changed lines
  Added in v.13

  ViewVC Help
Powered by ViewVC 1.1.26