--- trunk/lib/WebPAC/Normalize.pm 2005/12/05 17:47:51 217 +++ trunk/lib/WebPAC/Normalize.pm 2005/12/05 17:48:08 219 @@ -11,11 +11,11 @@ =head1 VERSION -Version 0.03 +Version 0.04 =cut -our $VERSION = '0.03'; +our $VERSION = '0.04'; =head1 SYNOPSIS @@ -82,11 +82,15 @@ db => $db_obj, lookup_regex => $lookup->regex, lookup => $lookup_obj, + prefix => 'foobar', ); Parametar C defines user supplied snippets of perl code which can be use with C notation. +C is used to form filename for database record (to support multiple +source files which are joined in one database). + Recommended parametar C is used to enable parsing of lookups in structures. If you pass this parametar, you must also pass C which is C object. @@ -111,6 +115,8 @@ $log->logdie("lookup must be WebPAC::Lookup object") if ($self->{'lookup'} && ! $self->{'lookup'}->isa('WebPAC::Lookup')); + $log->warn("no prefix defined. please check that!") unless ($self->{'prefix'}); + $self ? return $self : return undef; } @@ -138,12 +144,12 @@ $log->logdie("need unique ID (mfn) in field 000 of record ", sub { Dumper($rec) } ) unless (defined($rec->{'000'})); - my $mfn = $rec->{'000'}->[0] || $log->logdie("field 000 isn't array!"); + my $id = $rec->{'000'}->[0] || $log->logdie("field 000 isn't array!"); my $cache_file; if ($self->{'db'}) { - my $ds = $self->{'db'}->load_ds( id => $mfn ); + my $ds = $self->{'db'}->load_ds( id => $id, prefix => $self->{prefix} ); $log->debug("load_ds( rec = ", sub { Dumper($rec) }, ") = ", sub { Dumper($ds) }); return $ds if ($ds); $log->debug("cache miss, creating"); @@ -249,8 +255,9 @@ } $self->{'db'}->save_ds( - id => $mfn, + id => $id, ds => $ds, + prefix => $self->{prefix}, ) if ($self->{'db'}); $log->debug("ds: ", sub { Dumper($ds) });