5 use Test::More tests => 34;
8 use File::Temp qw/tempdir/;
13 use_ok( 'WebPAC::Lookup' );
14 use_ok( 'WebPAC::Input::ISIS' );
15 use_ok( 'WebPAC::DB' );
16 use_ok( 'WebPAC::Normalize::XML' );
17 use_ok( 'WebPAC::Output::TT' );
20 ok(my $abs_path = abs_path($0), "abs_path");
21 $abs_path =~ s#/[^/]*$#/#;
22 diag "abs_path: $abs_path";
24 my $isis_file = "$abs_path../t/winisis/BIBL";
25 $isis_file = '/data/hidra/THS/THS';
27 diag "isis_file: $isis_file";
29 ok(my $lookup = new WebPAC::Lookup(
30 lookup_file => "$abs_path../conf/lookup/isis.pm",
33 ok(my $isis = new WebPAC::Input::ISIS(
34 code_page => 'ISO-8859-2', # application encoding
36 ), "new Input::ISIS");
38 ok(my $maxmfn = $isis->open(
39 filename => $isis_file,
40 code_page => '852', # database encoding
41 ), "Input::ISIS->open");
43 ok(my $path = tempdir( CLEANUP => 1 ), "path");
45 ok(my $db = new WebPAC::DB(
49 ok(my $n = new WebPAC::Normalize::XML(
50 # filter => { 'foo' => sub { shift } },
52 lookup_regex => $lookup->regex,
54 ), "new Normalize::XML");
58 xml_file => "$abs_path../conf/normalize/isis.xml",
59 ), "Normalize::XML->open");
61 ok(my $out = new WebPAC::Output::TT(
62 include_path => "$abs_path../conf/output/tt",
63 filters => { foo => sub { shift } },
66 while (my $row = $isis->fetch) {
68 ok(my $ds = $n->data_structure($row), "data_structure");
72 ok(my $html = $out->apply(
73 template => 'html.tt',
77 $html =~ s#\s*[\n\r]+\s*##gs;