return $self->{'NXTMFN'} - 1;
}
-=head2 read_cnt
-
-Read content of C<.CNT> file and return hash containing it.
-
- print Dumper($isis->read_cnt);
-
-This function is not used by module (C<.CNT> files are not required for this
-module to work), but it can be useful to examine your index (while debugging
-for example).
-
-=cut
-
-sub read_cnt {
- my $self = shift;
-
- croak "missing CNT file in ",$self->{isisdb} unless ($self->{cnt_file});
-
- # Get the index information from $db.CNT
-
- open(my $fileCNT, $self->{cnt_file}) || croak "can't read '$self->{cnt_file}': $!";
- binmode($fileCNT);
-
- my $buff;
-
- read($fileCNT, $buff, 26) || croak "can't read first table from CNT: $!";
- $self->unpack_cnt($buff);
-
- read($fileCNT, $buff, 26) || croak "can't read second table from CNT: $!";
- $self->unpack_cnt($buff);
-
- close($fileCNT);
-
- return $self->{cnt};
-}
-
-=head2 unpack_cnt
-
-Unpack one of two 26 bytes fixed length record in C<.CNT> file.
-
-Here is definition of record:
-
- off key description size
- 0: IDTYPE BTree type s
- 2: ORDN Nodes Order s
- 4: ORDF Leafs Order s
- 6: N Number of Memory buffers for nodes s
- 8: K Number of buffers for first level index s
- 10: LIV Current number of Index Levels s
- 12: POSRX Pointer to Root Record in N0x l
- 16: NMAXPOS Next Available position in N0x l
- 20: FMAXPOS Next available position in L0x l
- 24: ABNORMAL Formal BTree normality indicator s
- length: 26 bytes
-
-This will fill C<$self> object under C<cnt> with hash. It's used by C<read_cnt>.
-
-=cut
-
-sub unpack_cnt {
- my $self = shift;
-
- my @flds = qw(ORDN ORDF N K LIV POSRX NMAXPOS FMAXPOS ABNORMAL);
-
- my $buff = shift || return;
- my @arr = unpack("vvvvvvVVVv", $buff);
-
- print STDERR "unpack_cnt: ",join(" ",@arr),"\n" if ($self->{'debug'});
-
- my $IDTYPE = shift @arr;
- foreach (@flds) {
- $self->{cnt}->{$IDTYPE}->{$_} = abs(shift @arr);
- }
-}
-
=head2 fetch
Read record with selected MFN
return $self->{'TagName'}->{$tag} || $tag;
}
+
+=head2 read_cnt
+
+Read content of C<.CNT> file and return hash containing it.
+
+ print Dumper($isis->read_cnt);
+
+This function is not used by module (C<.CNT> files are not required for this
+module to work), but it can be useful to examine your index (while debugging
+for example).
+
+=cut
+
+sub read_cnt {
+ my $self = shift;
+
+ croak "missing CNT file in ",$self->{isisdb} unless ($self->{cnt_file});
+
+ # Get the index information from $db.CNT
+
+ open(my $fileCNT, $self->{cnt_file}) || croak "can't read '$self->{cnt_file}': $!";
+ binmode($fileCNT);
+
+ my $buff;
+
+ read($fileCNT, $buff, 26) || croak "can't read first table from CNT: $!";
+ $self->unpack_cnt($buff);
+
+ read($fileCNT, $buff, 26) || croak "can't read second table from CNT: $!";
+ $self->unpack_cnt($buff);
+
+ close($fileCNT);
+
+ return $self->{cnt};
+}
+
+=head2 unpack_cnt
+
+Unpack one of two 26 bytes fixed length record in C<.CNT> file.
+
+Here is definition of record:
+
+ off key description size
+ 0: IDTYPE BTree type s
+ 2: ORDN Nodes Order s
+ 4: ORDF Leafs Order s
+ 6: N Number of Memory buffers for nodes s
+ 8: K Number of buffers for first level index s
+ 10: LIV Current number of Index Levels s
+ 12: POSRX Pointer to Root Record in N0x l
+ 16: NMAXPOS Next Available position in N0x l
+ 20: FMAXPOS Next available position in L0x l
+ 24: ABNORMAL Formal BTree normality indicator s
+ length: 26 bytes
+
+This will fill C<$self> object under C<cnt> with hash. It's used by C<read_cnt>.
+
+=cut
+
+sub unpack_cnt {
+ my $self = shift;
+
+ my @flds = qw(ORDN ORDF N K LIV POSRX NMAXPOS FMAXPOS ABNORMAL);
+
+ my $buff = shift || return;
+ my @arr = unpack("vvvvvvVVVv", $buff);
+
+ print STDERR "unpack_cnt: ",join(" ",@arr),"\n" if ($self->{'debug'});
+
+ my $IDTYPE = shift @arr;
+ foreach (@flds) {
+ $self->{cnt}->{$IDTYPE}->{$_} = abs(shift @arr);
+ }
+}
+
1;
=head1 BUGS