/[Biblio-Isis]/trunk/IsisDB.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/IsisDB.pm

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

revision 8 by dpavlin, Wed Dec 29 15:17:59 2004 UTC revision 9 by dpavlin, Wed Dec 29 16:01:41 2004 UTC
# Line 7  use Data::Dumper; Line 7  use Data::Dumper;
7  BEGIN {  BEGIN {
8          use Exporter ();          use Exporter ();
9          use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);          use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
10          $VERSION     = 0.02;          $VERSION     = 0.03;
11          @ISA         = qw (Exporter);          @ISA         = qw (Exporter);
12          #Give a hoot don't pollute, do not export more than needed by default          #Give a hoot don't pollute, do not export more than needed by default
13          @EXPORT      = qw ();          @EXPORT      = qw ();
# Line 66  Open CDS/ISIS database Line 66  Open CDS/ISIS database
66          isisdb => './cds/cds',          isisdb => './cds/cds',
67          read_fdt => 1,          read_fdt => 1,
68          debug => 1,          debug => 1,
69            include_deleted => 1,
70   );   );
71    
72  Options are described below:  Options are described below:
# Line 86  by default. Line 87  by default.
87    
88  Dump a C<lot> of debugging output.  Dump a C<lot> of debugging output.
89    
90    =item include_deleted
91    
92    Don't skip logically deleted records.
93    
94  =back  =back
95    
96  It will also set C<$isis-E<gt>{'maxmfn'}> which is maximum MFN stored in database.  It will also set C<$isis-E<gt>{'maxmfn'}> which is maximum MFN stored in database.
# Line 97  sub new { Line 102  sub new {
102          my $self = {};          my $self = {};
103          bless($self, $class);          bless($self, $class);
104    
105          $self->{isisdb} = {@_}->{isisdb} || croak "new needs database name as argument!";          croak "new needs database name (isisdb) as argument!" unless ({@_}->{isisdb});
106    
107          $self->{debug} = {@_}->{debug};          foreach my $v (qw{isisdb debug include_deleted}) {
108                    $self->{$v} = {@_}->{$v};
109            }
110    
111          # if you want to read .FDT file use read_fdt argument when creating class!          # if you want to read .FDT file use read_fdt argument when creating class!
112          if ({@_}->{read_fdt} && -e $self->{isisdb}.".FDT") {          if ({@_}->{read_fdt} && -e $self->{isisdb}.".FDT") {
# Line 173  sub new { Line 180  sub new {
180                  my $buff = shift || return;                  my $buff = shift || return;
181                  my @arr = unpack("ssssssllls", $buff);                  my @arr = unpack("ssssssllls", $buff);
182    
183                    print "unpack_cnt: ",join(" ",@arr),"\n" if ($self->{'debug'});
184    
185                  my $IDTYPE = shift @arr;                  my $IDTYPE = shift @arr;
186                  foreach (@flds) {                  foreach (@flds) {
187                          $self->{$IDTYPE}->{$_} = abs(shift @arr);                          $self->{$IDTYPE}->{$_} = abs(shift @arr);
# Line 270  print ("Error: The MFN:".$mfn." is not f Line 279  print ("Error: The MFN:".$mfn." is not f
279    
280          print "MFRL: $MFRL MFBWB: $MFBWB MFBWP: $MFBWP BASE: $BASE NVF: $NVF STATUS: $STATUS\n" if ($self->{debug});          print "MFRL: $MFRL MFBWB: $MFBWB MFBWP: $MFBWP BASE: $BASE NVF: $NVF STATUS: $STATUS\n" if ($self->{debug});
281    
282            # delete old record
283            delete $self->{record};
284    
285            if (! $self->{'include_deleted'} && $MFRL < 0) {
286                    print "## logically deleted record $mfn, skipping...\n" if ($self->{debug});
287                    return;
288            }
289    
290          # Get Directory Format          # Get Directory Format
291    
292          my @FieldPOS;          my @FieldPOS;
# Line 309  print ("Error: The MFN:".$mfn." is not f Line 326  print ("Error: The MFN:".$mfn." is not f
326    
327          # Get Variable Fields          # Get Variable Fields
328    
         delete $self->{record};  
   
329          read($self->{'fileMST'},$buff,$fld_len);          read($self->{'fileMST'},$buff,$fld_len);
330    
331          for (my $i = 0 ; $i < $NVF ; $i++) {          for (my $i = 0 ; $i < $NVF ; $i++) {
# Line 318  print ("Error: The MFN:".$mfn." is not f Line 333  print ("Error: The MFN:".$mfn." is not f
333          }          }
334          close(fileMST);          close(fileMST);
335    
         # The record is marked for deletion  
         if ($STATUS==1) {  
                 return -1;  
         }  
   
336          print Dumper($self) if ($self->{debug});          print Dumper($self) if ($self->{debug});
337    
338          return $self->{'record'};          return $self->{'record'};

Legend:
Removed from v.8  
changed lines
  Added in v.9

  ViewVC Help
Powered by ViewVC 1.1.26