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 (); |
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: |
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. |
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") { |
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); |
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; |
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++) { |
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'}; |