X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=Equinox-Migration%2Flib%2FEquinox%2FMigration%2FMARCXMLSampler.pm;h=26d75ac79c7749767a335e0c1bfbcc4e023b97e0;hp=d6fc65ec374418e7087492eb6189ae22f00a1851;hb=3993208cd9519a085dedbd38c96b6077896d9fb0;hpb=abb4c8edd07f27bc3faf791802c2eedf8922bb2c diff --git a/Equinox-Migration/lib/Equinox/Migration/MARCXMLSampler.pm b/Equinox-Migration/lib/Equinox/Migration/MARCXMLSampler.pm index d6fc65e..26d75ac 100644 --- a/Equinox-Migration/lib/Equinox/Migration/MARCXMLSampler.pm +++ b/Equinox-Migration/lib/Equinox/Migration/MARCXMLSampler.pm @@ -19,7 +19,6 @@ Version 1.003 our $VERSION = '1.003'; -my $xmltwig; my $taglist; my $dstore; @@ -74,15 +73,6 @@ sub new { 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}); @@ -91,10 +81,16 @@ sub new { $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; }