/[webpac]/trunk2/all2all.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk2/all2all.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 389 - (hide annotations)
Tue Jul 20 17:15:48 2004 UTC (15 years ago) by dpavlin
File MIME type: text/plain
File size: 1591 byte(s)
added progress_bar

1 dpavlin 1 #!/usr/bin/perl -w
2    
3 dpavlin 348 =head1 NAME
4    
5 dpavlin 354 all2all.pl - basic script for all WebPAC needs
6 dpavlin 348
7     =cut
8    
9 dpavlin 1 use strict;
10     use Data::Dumper;
11 dpavlin 352 use Carp;
12 dpavlin 1
13 dpavlin 352 use lib './lib';
14 dpavlin 354 use WebPAC;
15 dpavlin 348
16 dpavlin 372
17 dpavlin 354 my $webpac = new WebPAC(
18 dpavlin 352 code_page => 'ISO-8859-2',
19 dpavlin 389 limit_mfn => 100,
20 dpavlin 372 # debug => 1,
21 dpavlin 352 ) || die;
22    
23 dpavlin 373 my $log = $webpac->_get_logger();
24    
25 dpavlin 10 $|=1;
26 dpavlin 9
27 dpavlin 352 my $maxmfn = $webpac->open_isis(
28 dpavlin 357 filename => shift @ARGV || '/data/hidra/THS/THS',
29 dpavlin 352 lookup => [
30 dpavlin 348 { 'key' => 'd:v900', 'val' => 'v250^a' },
31 dpavlin 352 # { 'eval' => '"v901^a" eq "Podruèje"', 'key' => 'pa:v561^4:v562^4:v461^1', 'val' => 'v900' },
32     # { 'eval '=> '"v901^a" eq "Mikrotezaurus"', 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },
33     # { 'eval' => '"v901^a" eq "Deskriptor"', 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },
34     { 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },
35 dpavlin 374 { 'key' => '900_mfn:v900', 'val' => 'v000' },
36 dpavlin 352 ],
37 dpavlin 54 );
38 dpavlin 3
39 dpavlin 372 $log->info("rows: $maxmfn");
40 dpavlin 170
41 dpavlin 363 $webpac->open_import_xml(type => 'isis_hidra_ths');
42    
43 dpavlin 362 while (my $rec = $webpac->fetch_rec) {
44 dpavlin 358
45 dpavlin 370 my @ds = $webpac->data_structure($rec);
46 dpavlin 366
47 dpavlin 372 if ($log->is_debug) {
48     $log->debug("rec = ",Dumper($rec));
49     $log->debug("ds = ",Dumper(\@ds));
50     }
51    
52 dpavlin 374 next if (! @ds);
53 dpavlin 366
54 dpavlin 374 my $filename = $webpac->{'current_filename'};
55    
56     if ($filename) {
57     open(OUT,"> $filename") || $log->logdie("can't open output '$filename': $!");
58     print OUT $webpac->output(
59     template => 'html.tt',
60     data => \@ds,
61     );
62     close(OUT);
63     } else {
64     print $webpac->output(
65     template => 'text.tt',
66     data => \@ds,
67     );
68     }
69    
70 dpavlin 3 }
71    
72 dpavlin 372 if ($log->is_debug) {
73     $log->debug("lookup hash: ",Dumper($webpac->{'lookup'}));
74     $log->debug("data hash: ",Dumper($webpac->{'data'}));
75     }

Properties

Name Value
cvs2svn:cvs-rev 1.64
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26