MARC-Loop

 view release on metacpan or  search on metacpan

lib/MARC/Loop.pm  view on Meta::CPAN


use strict;
use warnings;

require Exporter;

use vars qw($VERSION @ISA @EXPORT_OK);

$VERSION = '0.01';

sub marcloop(&;$%);

use constant TAG    => 0;
use constant VALREF => 1;
use constant DELETE => 2;
use constant IND1   => 3;
use constant IND2   => 4;
use constant SUBS   => 5;

use constant SUB_ID     => 0;
use constant SUB_VALREF => 1;

use constant RECORD_TERMINATOR  => "\x1d";
use constant FIELD_TERMINATOR   => "\x1e";
use constant SUBFIELD_DELIMITER => "\x1f";

@ISA = qw(Exporter);
@EXPORT_OK = qw(marcloop marcparse marcfield marcindicators marcbuild TAG VALREF DELETE IND1 IND2 SUBS SUB_ID SUB_VALREF RECORD_TERMINATOR FIELD_TERMINATOR SUBFIELD_DELIMITER);

sub marcloop(&;$%) {
    my ($sub, $f, %arg) = @_;
    my $fh;
    $arg{'print'} = 1 if $arg{'print_all'};
    my (%drop, %only);
    if ($arg{'drop'}) {
        %drop = map { $_ => 1 } @{ $arg{'drop'} };
    }
    if ($arg{'only'}) {
        %only = map { $_ => 1 } @{ $arg{'only'} };
        die "drop and only are mutually exclusive" if %drop && %only;



( run in 0.341 second using v1.01-cache-2.11-cpan-49f99fa48dc )