--- trunk/lib/WebPAC/Input/MARC.pm 2006/09/29 18:55:41 725 +++ trunk/lib/WebPAC/Input/MARC.pm 2006/09/29 19:52:17 726 @@ -4,6 +4,7 @@ use strict; use MARC::Fast 0.03; +use base qw/WebPAC::Common/; =head1 NAME @@ -11,11 +12,11 @@ =head1 VERSION -Version 0.05 +Version 0.06 =cut -our $VERSION = '0.05'; +our $VERSION = '0.06'; =head1 SYNOPSIS @@ -23,24 +24,27 @@ Open USMARC, Unimarc or any other file format that has same internal structure using C. - my $marc = new WebPAC::Input::MARC(); - $marc->open( path => '/path/to/marc.iso' ); + my $marc = new WebPAC::Input::MARC( + path => '/path/to/marc.iso' + ); =head1 FUNCTIONS -=head2 open_db +=head2 new -Returns handle to database and size in records +Returns new low-level input API object - my ($db,$size) = $open_db( + my $marc = new WebPAC::Input::MARC( path => '/path/to/marc.iso', filter => \&code_ref, } =cut -sub open_db { - my $self = shift; +sub new { + my $class = shift; + my $self = {@_}; + bless($self, $class); my $arg = {@_}; @@ -57,7 +61,7 @@ $self->{_marc_size} = $db_size; $self->{_marc_db} = $db; - return ($db, $db_size); + $self ? return $self : return undef; } =head2 fetch_rec @@ -84,14 +88,18 @@ } } -=head1 PROPERTIES +=head2 size -=head2 _marc_size +Return number of records in database -Store size of MARC database + my $size = $isis->size; - print $self->{_marc_size}; +=cut +sub size { + my $self = shift; + return $self->{_marc_size}; +} =head1 AUTHOR