our $VERSION = '1.003';
-my $xmltwig;
my $taglist;
my $dstore;
my $self = bless { data => $dstore,
}, $class;
- # initialize twig
- die "Argument 'marcfile' must be specified\n" unless ($args{marcfile});
- if (-r $args{marcfile}) {
- $xmltwig = XML::Twig->new( twig_handlers => { record => \&parse_record } );
- $self->{conf}{marc} = $args{marcfile};
- } else {
- die "Can't open marc file: $!\n";
- }
-
# if we have a sample arg, create the sample map
die "Can't use a mapfile and mapstring\n"
if ($args{mapfile} and $args{mapstring});
$taglist = Equinox::Migration::SimpleTagList->new(str => $args{mapstring})
if ($args{mapstring});
- # do the xml processing
- $xmltwig->parsefile( $self->{conf}{marc} );
+ # initialize twig and process xml
+ die "Argument 'marcfile' must be specified\n" unless ($args{marcfile});
+ if (-r $args{marcfile}) {
+ my $xmltwig = XML::Twig->new( twig_handlers => { record => \&parse_record } );
+ $xmltwig->parsefile( $args{marcfile} );
+ } else {
+ die "Can't open marc file: $!\n";
+ }
- # hand ourselves back for
+ # hand ourselves back for datastore manipulation
return $self;
}
# handle unmapped tag/subs
my $samp = $dstore->{samp};
# set a value, total-seen count and records-seen-in count
- $samp->{$tag}{$code}{value} = $sub->text unless $samp->{$tag}{$code};
+ $samp->{$tag}{$code}{value} = $sub->text unless ($samp->{$tag}{$code}{value} and
+ $samp->{$tag}{$code}{value} =~ /\w/);
$samp->{$tag}{$code}{count}++;
$samp->{$tag}{$code}{tcnt}++ unless ( defined $samp->{$tag}{$code}{last} and
$samp->{$tag}{$code}{last} == $dstore->{tcnt} );