| 1 |
#!perl |
| 2 |
|
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
use Test::More; |
| 6 |
use Test::Exception; |
| 7 |
use Catmandu::Importer::MARC; |
| 8 |
|
| 9 |
my $pkg; |
| 10 |
|
| 11 |
BEGIN { |
| 12 |
$pkg = 'Catmandu::Importer::MARC::MicroLIF'; |
| 13 |
use_ok $pkg; |
| 14 |
} |
| 15 |
|
| 16 |
require_ok $pkg; |
| 17 |
|
| 18 |
my $importer = Catmandu::Importer::MARC->new( file => 't/sample1.lif', type => "MicroLIF" ); |
| 19 |
|
| 20 |
ok $importer , 'got an MARC/MicroLIF importer'; |
| 21 |
|
| 22 |
my @records; |
| 23 |
|
| 24 |
my $n = $importer->each( |
| 25 |
sub { |
| 26 |
push( @records, $_[0] ); |
| 27 |
} |
| 28 |
); |
| 29 |
|
| 30 |
ok(@records == 1); |
| 31 |
|
| 32 |
ok($records[0]->{record}->[1]->[0] eq '008'); |
| 33 |
|
| 34 |
done_testing; |