SYNOPSIS

  use Biblio::Isis;

my $isis = new Biblio::Isis( isisdb => './cds/cds', );

for(my $mfn = 1; $mfn <= $isis->count; $mfn++) { print $isis->to_ascii($mfn),"\n"; }

DESCRIPTION

This module will read \s-1ISIS\s0 databases created by \s-1DOS\s0 \s-1CDS/ISIS\s0, WinIsis or IsisMarc. It can be used as perl-only alternative to OpenIsis module which seems to depriciate it's old \*(C`XS\*(C' bindings for perl.

It can create hash values from data in \s-1ISIS\s0 database (using \*(C`to_hash\*(C'), \s-1ASCII\s0 dump (using \*(C`to_ascii\*(C') or just hash with field names and packed values (like \*(C`^asomething^belse\*(C').

Unique feature of this module is ability to \*(C`include_deleted\*(C' records. It will also skip zero sized fields (OpenIsis has a bug in \s-1XS\s0 bindings, so fields which are zero sized will be filled with random junk from memory).

It also has support for identifiers (only if \s-1ISIS\s0 database is created by IsisMarc), see \*(C`to_hash\*(C'.

This module will always be slower than OpenIsis module which use C library. However, since it's written in perl, it's platform independent (so you don't need C compiler), and can be easily modified. I hope that it creates data structures which are easier to use than ones created by OpenIsis, so reduced time in other parts of the code should compensate for slower performance of this module (speed of reading \s-1ISIS\s0 database is rarely an issue).

METHODS

\$1

Open \s-1ISIS\s0 database

my $isis = new Biblio::Isis( isisdb => './cds/cds', read_fdt => 1, include_deleted => 1, hash_filter => sub { my ($v,$field_number) = @_; $v =~ s#foo#bar#g; }, debug => 1, join_subfields_with => ' ; ', );

Options are described below:

isisdb

This is full or relative path to \s-1ISIS\s0 database files which include common prefix of \*(C`.MST\*(C', and \*(C`.XRF\*(C' and optionally \*(C`.FDT\*(C' (if using \*(C`read_fdt\*(C' option) files. In this example it uses \*(C`./cds/cds.MST\*(C' and related files.

read_fdt

Boolean flag to specify if field definition table should be read. It's off by default.

include_deleted

Don't skip logically deleted records in \s-1ISIS\s0.

hash_filter

Filter code ref which will be used before data is converted to hash. It will receive two arguments, whole line from current field (in $_[0]) and field number (in $_[1]).

debug

Dump a lot of debugging output even at level 1. For even more increase level.

join_subfields_with

Define delimiter which will be used to join repeatable subfields. This option is included to support lagacy application written against version older than 0.21 of this module. By default, it disabled. See \*(L"to_hash\*(R".

ignore_empty_subfields

Remove all empty subfields while reading from \s-1ISIS\s0 file. Return number of records in database

print $isis->count; Read record with selected \s-1MFN\s0

my $rec = $isis->fetch(55);

Returns hash with keys which are field names and values are unpacked values for that field like this:

$rec = { '210' => [ '^aNew York^cNew York University press^dcop. 1988' ], '990' => [ '2140', '88', 'HAY' ], }; Returns current \s-1MFN\s0 position

my $mfn = $isis->mfn; Returns \s-1ASCII\s0 output of record with specified \s-1MFN\s0

print $isis->to_ascii(42);

This outputs something like this:

210 ^aNew York^cNew York University press^dcop. 1988 990 2140 990 88 990 HAY

If \*(C`read_fdt\*(C' is specified when calling \*(C`new\*(C' it will display field names from \*(C`.FDT\*(C' file instead of numeric tags. Read record with specified \s-1MFN\s0 and convert it to hash

my $hash = $isis->to_hash($mfn);

It has ability to convert characters (using \*(C`hash_filter\*(C') from \s-1ISIS\s0 database before creating structures enabling character re-mapping or quick fix-up of data.

This function returns hash which is like this:

$hash = { '210' => [ { 'c' => 'New York University press', 'a' => 'New York', 'd' => 'cop. 1988' } ], '990' => [ '2140', '88', 'HAY' ], };

You can later use that hash to produce any output from \s-1ISIS\s0 data.

If database is created using IsisMarc, it will also have to special fields which will be used for identifiers, \*(C`i1\*(C' and \*(C`i2\*(C' like this:

'200' => [ { 'i1' => '1', 'i2' => ' ' 'a' => 'Goa', 'f' => 'Valdo D\'Arienzo', 'e' => 'tipografie e tipografi nel XVI secolo', } ],

In case there are repeatable subfields in record, this will create following structure:

'900' => [ { 'a' => [ 'foo', 'bar', 'baz' ], }]

Or in more complex example of

902 ^aa1^aa2^aa3^bb1^aa4^bb2^cc1^aa5

it will create

902 => [ { a => ["a1", "a2", "a3", "a4", "a5"], b => ["b1", "b2"], c => "c1" }, ],

This behaviour can be changed using \*(C`join_subfields_with\*(C' option to \*(L"new\*(R", in which case \*(C`to_hash\*(C' will always create single value for each subfield. This will change result to:

This method will also create additional field 000 with \s-1MFN\s0.

There is also more elaborative way to call \*(C`to_hash\*(C' like this:

my $hash = $isis->to_hash({ mfn => 42, include_subfields => 1, });

Each option controll creation of hash:

mfn

Specify \s-1MFN\s0 number of record

include_subfields

This option will create additional key in hash called \*(C`subfields\*(C' which will have original record subfield order and index to that subfield like this: 902 => [ { a => ["a1", "a2", "a3", "a4", "a5"], b => ["b1", "b2"], c => "c1", subfields => ["a", 0, "a", 1, "a", 2, "b", 0, "a", 3, "b", 1, "c", 0, "a", 4], } ],

join_subfields_with

Define delimiter which will be used to join repeatable subfields. You can specify option here instead in \*(L"new\*(R" if you want to have per-record control.

hash_filter

You can override \*(C`hash_filter\*(C' defined in \*(L"new\*(R" using this option. Return name of selected tag

print $isis->tag_name('200'); Read content of \*(C`.CNT\*(C' file and return hash containing it.

print Dumper($isis->read_cnt);

This function is not used by module (\*(C`.CNT\*(C' files are not required for this module to work), but it can be useful to examine your index (while debugging for example). Unpack one of two 26 bytes fixed length record in \*(C`.CNT\*(C' 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 $self object under \*(C`cnt\*(C' with hash. It's used by \*(C`read_cnt\*(C'.

BUGS

Some parts of \s-1CDS/ISIS\s0 documentation are not detailed enough to exmplain some variations in input databases which has been tested with this module. When I was in doubt, I assumed that OpenIsis's implementation was right (except for obvious bugs).

However, every effort has been made to test this module with as much databases (and programs that create them) as possible.

I would be very greatful for success or failure reports about usage of this module with databases from programs other than WinIsis and IsisMarc. I had tested this against ouput of one \*(C`isis.dll\*(C'-based application, but I don't know any details about it's version.

VERSIONS

As this is young module, new features are added in subsequent version. It's a good idea to specify version when using this module like this:

use Biblio::Isis 0.23

Below is list of changes in specific version of module (so you can target older versions if you really have to):

0.24

Added \*(C`ignore_empty_subfields\*(C'

0.23

Added \*(C`hash_filter\*(C' to \*(L"to_hash\*(R" Fixed bug with documented \*(C`join_subfields_with\*(C' in \*(L"new\*(R" which wasn't implemented

0.22

Added field number when calling \*(C`hash_filter\*(C'

0.21

Added \*(C`join_subfields_with\*(C' to \*(L"new\*(R" and \*(L"to_hash\*(R". Added \*(C`include_subfields\*(C' to \*(L"to_hash\*(R".

0.20

Added \*(C`$isis->mfn\*(C', support for repeatable subfields and \*(C`$isis->to_hash({ mfn => 42, ... })\*(C' calling convention

AUTHOR

Dobrica Pavlinusic CPAN ID: DPAVLIN [email protected] http://www.rot13.org/~dpavlin/

This module is based heavily on code from \*(C`LIBISIS.PHP\*(C' library to read \s-1ISIS\s0 files V0.1.1 written in php and (c) 2000 Franck Martin <[email protected]> and released under \s-1LGPL\s0.

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the \s-1LICENSE\s0 file included with this module.

RELATED TO Biblio::Isis…

Biblio::Isis::Manual for \s-1CDS/ISIS\s0 manual appendix F, G and H which describe file format

OpenIsis web site <http://www.openisis.org>

perl4lib site <http://perl4lib.perl.org>