Changeset 8716
- Timestamp:
- 2004-12-01T16:14:11+13:00 (19 years ago)
- Location:
- trunk/gsdl/perllib
- Files:
-
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/classify/AZCompactList.pm
r7835 r8716 168 168 } 169 169 170 if (! $metaname) {170 if (!defined($metaname)) { 171 171 my $outhandle = $self->{'outhandle'}; 172 172 print $outhandle "AZCompactList Error: required option -metadata not supplied\n"; -
trunk/gsdl/perllib/classify/AllList.pm
r8221 r8716 3 3 4 4 sub BEGIN { 5 @ ISA = ('BasClas');5 @AllList::ISA = ('BasClas'); 6 6 } 7 7 -
trunk/gsdl/perllib/classify/BasClas.pm
r8221 r8716 92 92 sub print_xml_usage 93 93 { 94 local$self = shift(@_);94 my $self = shift(@_); 95 95 96 96 # XML output is always in UTF-8 … … 104 104 sub print_xml 105 105 { 106 local$self = shift(@_);107 108 local$optionlistref = $self->{'option_list'};109 local@optionlist = @$optionlistref;110 local$classifieroptions = pop(@$optionlistref);106 my $self = shift(@_); 107 108 my $optionlistref = $self->{'option_list'}; 109 my @optionlist = @$optionlistref; 110 my $classifieroptions = pop(@$optionlistref); 111 111 return if (!defined($classifieroptions)); 112 112 … … 134 134 sub print_txt_usage 135 135 { 136 local$self = shift(@_);136 my $self = shift(@_); 137 137 138 138 # Print the usage message for a classifier (recursively) 139 local$descoffset = $self->determine_description_offset(0);139 my $descoffset = $self->determine_description_offset(0); 140 140 $self->print_classifier_usage($descoffset, 1); 141 141 } … … 144 144 sub determine_description_offset 145 145 { 146 local$self = shift(@_);147 local$maxoffset = shift(@_);148 149 local$optionlistref = $self->{'option_list'};150 local@optionlist = @$optionlistref;151 local$classifieroptions = pop(@$optionlistref);146 my $self = shift(@_); 147 my $maxoffset = shift(@_); 148 149 my $optionlistref = $self->{'option_list'}; 150 my @optionlist = @$optionlistref; 151 my $classifieroptions = pop(@$optionlistref); 152 152 return $maxoffset if (!defined($classifieroptions)); 153 153 154 154 # Find the length of the longest option string of this classifier 155 local$classifierargs = $classifieroptions->{'args'};155 my $classifierargs = $classifieroptions->{'args'}; 156 156 if (defined($classifierargs)) { 157 local$longest = &PrintUsage::find_longest_option_string($classifierargs);157 my $longest = &PrintUsage::find_longest_option_string($classifierargs); 158 158 if ($longest > $maxoffset) { 159 159 $maxoffset = $longest; … … 170 170 sub print_classifier_usage 171 171 { 172 local$self = shift(@_);173 local$descoffset = shift(@_);174 local$isleafclass = shift(@_);175 176 local$optionlistref = $self->{'option_list'};177 local@optionlist = @$optionlistref;178 local$classifieroptions = pop(@$optionlistref);172 my $self = shift(@_); 173 my $descoffset = shift(@_); 174 my $isleafclass = shift(@_); 175 176 my $optionlistref = $self->{'option_list'}; 177 my @optionlist = @$optionlistref; 178 my $classifieroptions = pop(@$optionlistref); 179 179 return if (!defined($classifieroptions)); 180 180 181 local$classifiername = $classifieroptions->{'name'};182 local$classifierargs = $classifieroptions->{'args'};183 local$classifierdesc = $classifieroptions->{'desc'};181 my $classifiername = $classifieroptions->{'name'}; 182 my $classifierargs = $classifieroptions->{'args'}; 183 my $classifierdesc = $classifieroptions->{'desc'}; 184 184 # Produce the usage information using the data structure above 185 185 if ($isleafclass) { … … 194 194 if (defined($classifierargs)) { 195 195 # Calculate the column offset of the option descriptions 196 local$optiondescoffset = $descoffset + 2; # 2 spaces between options & descriptions196 my $optiondescoffset = $descoffset + 2; # 2 spaces between options & descriptions 197 197 198 198 if ($isleafclass) { -
trunk/gsdl/perllib/classify/DateList.pm
r8647 r8716 57 57 'type' => "metadata", 58 58 'reqd' => "no" } , 59 { 'name' => "reverse_sort", 60 'desc' => "{DateList.reverse_sort}", 61 'type' => "flag", 62 'reqd' => "no" }, 59 63 { 'name' => "bymonth", 60 64 'desc' => "{DateList.bymonth}", … … 63 67 { 'name' => "nogroup", 64 68 'desc' => "{DateList.nogroup}", 65 'type' => "flag",66 'reqd' => "no" },67 { 'name' => "newest_first",68 'desc' => "{DateList.newest_first}",69 69 'type' => "flag", 70 70 'reqd' => "no" } -
trunk/gsdl/perllib/classify/Hierarchy.pm
r8221 r8716 35 35 36 36 sub BEGIN { 37 @ ISA = ('BasClas');37 @Hierarchy::ISA = ('BasClas'); 38 38 } 39 39 … … 58 58 'deft' => "{BasClas.metadata.deft}", 59 59 'reqd' => "no" }, 60 { 'name' => "reverse_sort", 61 'desc' => "{Hierarchy.reverse_sort}", 62 'type' => "flag", 63 'reqd' => "no" }, 60 64 { 'name' => "hlist_at_top", 61 65 'desc' => "{Hierarchy.hlist_at_top}", … … 83 87 } 84 88 85 my ($hfile, $metadata, $sortname, $ title, $hlist_at_top);89 my ($hfile, $metadata, $sortname, $reverse_sort, $title, $hlist_at_top); 86 90 87 91 if (!parsargv::parse(\@_, 88 92 q^buttonname/.*/^, \$title, 89 93 q^sort/.*/^, \$sortname, 94 q^reverse_sort^, \$reverse_sort, 90 95 q^hfile/.*/^, \$hfile, 91 96 q^metadata/.*/^, \$metadata, … … 117 122 $sortname = $metadata unless ($sortname); 118 123 $sortname = undef if $sortname =~ /^nosort$/; 119 124 if (defined $sortname && $reverse_sort) { 125 $self->{'reverse_sort'} = 1; 126 } 127 120 128 my $subjectfile; 121 129 $subjectfile = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"etc", $hfile); … … 225 233 226 234 if (defined $self->{'sortname'}) { 235 if ($self->{'reverse_sort'}) { 236 foreach $subOID (sort {$b->[1] cmp $a->[1];} @{$list->{$OID}->{'contents'}}) { 237 push (@{$tempinfo->{'contains'}}, {'OID'=>$subOID->[0]}); 238 } 239 } else { 227 240 foreach $subOID (sort {$a->[1] cmp $b->[1];} @{$list->{$OID}->{'contents'}}) { 228 241 push (@{$tempinfo->{'contains'}}, {'OID'=>$subOID->[0]}); … … 262 275 $classifyinfo->{'contains'} = [] unless defined $classifyinfo->{'contains'}; 263 276 my $offset = 0; 264 foreach $thing (@{$classifyinfo->{'contains'}}) {277 foreach my $thing (@{$classifyinfo->{'contains'}}) { 265 278 $offset ++ if defined $thing->{'OID'}; 266 279 } -
trunk/gsdl/perllib/doc.pm
r8504 r8716 95 95 my $newobj = {}; 96 96 97 foreach $k (keys %$self) {97 foreach my $k (keys %$self) { 98 98 $newobj->{$k} = &clone ($self->{$k}); 99 99 } … … 109 109 if ($type eq "HASH") { 110 110 my $to = {}; 111 foreach $key (keys %$from) {111 foreach my $key (keys %$from) { 112 112 $to->{$key} = &clone ($from->{$key}); 113 113 } … … 115 115 } elsif ($type eq "ARRAY") { 116 116 my $to = []; 117 foreach $v (@$from) {117 foreach my $v (@$from) { 118 118 push (@$to, &clone ($v)); 119 119 } … … 128 128 my ($type) = @_; 129 129 130 if ($type eq "incremental") {130 if ($type =~ /^(hash|incremental|dirname)$/) { 131 131 $self->{'OIDtype'} = $type; 132 132 } else { … … 638 638 $OID = "D" . $OIDcount; 639 639 $OIDcount ++; 640 641 } elsif ($self->{'OIDtype'} eq "dirname") { 642 $OID = 'J'; 643 my $filename = $self->get_source_filename(); 644 if (defined($filename) && -e $filename) { 645 $OID = &File::Basename::dirname($filename); 646 if (defined $OID) { 647 $OID = 'J'.&File::Basename::basename($OID); 648 } else { 649 print STDERR "Failed to find base for filename ($filename).....\n"; 650 die("\n"); 651 } 652 } else { 653 print STDERR "Failed to find filename.....\n"; 654 die("\n"); 655 } 640 656 641 657 } else { … … 1002 1018 my $section_ptr = $self->_lookup_section($section); 1003 1019 if (!defined $section_ptr) { 1004 print STDERR "doc::get_metadata_element couldn't find section " . 1005 "$section\n"; 1020 print STDERR "doc::get_metadata_element couldn't find section ", $section, "\n"; 1006 1021 return; 1007 1022 } … … 1036 1051 my $section_ptr = $self->_lookup_section($section); 1037 1052 if (!defined $section_ptr) { 1038 print STDERR "doc::get_metadata couldn't find section " .1039 "$section\n";1053 print STDERR "doc::get_metadata couldn't find section ", 1054 $section, "\n"; 1040 1055 return; 1041 1056 } … … 1068 1083 my $section_ptr = $self->_lookup_section($section); 1069 1084 if (!defined $section_ptr) { 1070 print STDERR "doc::get_all_metadata couldn't find section " . 1071 "$section\n"; 1085 print STDERR "doc::get_all_metadata couldn't find section ", $section, "\n"; 1072 1086 return; 1073 1087 } … … 1083 1097 my $section_ptr = $self->_lookup_section($section); 1084 1098 if (!defined $section_ptr) { 1085 print STDERR "doc::delete_metadata couldn't find section " . 1086 "$section\n"; 1099 print STDERR "doc::delete_metadata couldn't find section ", $section, "\n"; 1087 1100 return; 1088 1101 } … … 1105 1118 my $section_ptr = $self->_lookup_section($section); 1106 1119 if (!defined $section_ptr) { 1107 print STDERR "doc::delete_all_metadata couldn't find section " . 1108 "$section\n"; 1120 print STDERR "doc::delete_all_metadata couldn't find section ", $section, "\n"; 1109 1121 return; 1110 1122 } … … 1149 1161 my $section_ptr = $self->_lookup_section($section); 1150 1162 if (!defined $section_ptr) { 1151 print STDERR "doc::add_utf8_metadata couldn't find section " . 1152 "$section\n"; 1163 print STDERR "doc::add_utf8_metadata couldn't find section ", $section, "\n"; 1153 1164 return; 1154 1165 } -
trunk/gsdl/perllib/docprint.pm
r2267 r8716 35 35 36 36 sub BEGIN { 37 @ ISA = ('docproc');37 @docprint::ISA = ('docproc'); 38 38 } 39 39 … … 51 51 # add associated files as metadata to the document 52 52 my @assoc_files = (); 53 foreach $assoc_file (@{$doc_obj->get_assoc_files()}) {53 foreach my $assoc_file (@{$doc_obj->get_assoc_files()}) { 54 54 if (-e $assoc_file->[0]) { 55 55 $doc_obj->add_metadata ($doc_obj->get_top_section(), -
trunk/gsdl/perllib/docproc.pm
r7902 r8716 45 45 } 46 46 47 # OIDtype may be "hash" or "incremental" 47 # OIDtype may be "hash" or "incremental" or "dirname" 48 48 sub set_OIDtype { 49 49 my $self = shift (@_); 50 50 my ($type) = @_; 51 51 52 if ($type eq "incremental") {52 if ($type =~ /^(hash|incremental|dirname)$/) { 53 53 $self->{'OIDtype'} = $type; 54 54 } else { -
trunk/gsdl/perllib/docsave.pm
r8517 r8716 61 61 $self->{'verbosity'} = $verbosity; 62 62 $self->{'gzip'} = $gzip; 63 63 $self->{'keepimportstructure'} = 0; 64 64 $self->{'groupsize'} = $groupsize; 65 65 $self->{'gs_count'} = 0; … … 127 127 128 128 # get document's directory 129 my $doc_dir = $self->get_doc_dir ($OID );129 my $doc_dir = $self->get_doc_dir ($OID, $doc_obj->get_source_filename()); 130 130 131 131 # groupsize is 1 (i.e. one document per XML file) so sortmeta … … 342 342 343 343 # get document's directory 344 my $doc_dir = $self->get_doc_dir ($OID );344 my $doc_dir = $self->get_doc_dir ($OID, $doc_obj->get_source_filename()); 345 345 346 346 # copy all the associated files, add this information as metadata … … 380 380 sub get_doc_dir { 381 381 my $self = shift (@_); 382 my ($OID ) = @_;382 my ($OID, $source_filename) = @_; 383 383 my $doc_info; 384 my $doc_dir ;384 my $doc_dir = ''; 385 385 my $service = $self-> {'service'}; 386 386 my $working_dir; … … 403 403 $doc_dir = $doc_info->[0]; 404 404 $doc_dir =~ s/\/?doc\.xml(\.gz)?$//; 405 } else { 405 } elsif ($self->{'keepimportstructure'}) { 406 $source_filename = &File::Basename::dirname($source_filename); 407 $source_filename =~ s/[\\\/]+/\//g; 408 $source_filename =~ s/\/$//; 409 410 411 #print STDERR "Source filename: $source_filename; \nImport dir:",$ENV{'GSDLIMPORTDIR'}, "\n"; 412 $doc_dir = substr($source_filename, length($ENV{'GSDLIMPORTDIR'}) + 1); 413 414 } 415 if ($doc_dir eq "") { 406 416 # have to get a new document directory 407 417 my $doc_dir_rest = $OID; -
trunk/gsdl/perllib/encodings.pm
r6807 r8716 36 36 # routine this is the name of that routine. 37 37 38 $encodings = {38 $encodings::encodings = { 39 39 'iso_8859_1' => {'name' => 'Latin1 (western languages)', 'mapfile' => '8859_1.ump'}, 40 40 -
trunk/gsdl/perllib/ghtml.pm
r7903 r8716 88 88 89 89 # named entry to the standard html font 90 %charnetosf = ("Agrave"=> "192", "Aacute"=> "193", "Acirc" => "194", "Atilde"=> "195",90 my %charnetosf = ("Agrave"=> "192", "Aacute"=> "193", "Acirc" => "194", "Atilde"=> "195", 91 91 "Auml" => "196", "Aring" => "197", "AElig" => "198", "Ccedil"=> "199", 92 92 "Egrave"=> "200", "Eacute"=> "201", "Ecirc" => "202", "Euml" => "203", … … 105 105 "uuml" => "252", "yacute"=> "253", "thorn" => "254", "yuml" => "255"); 106 106 107 %symnetosf = ("quot" => "34", "amp" => "38", "lt" => "60", "gt" => "62",107 my %symnetosf = ("quot" => "34", "amp" => "38", "lt" => "60", "gt" => "62", 108 108 "nbsp" => "160", "iexcl" => "161", "cent" => "162", "pound" => "163", 109 109 "curren"=> "164", "yen" => "165", "brvbar"=> "166", "sect" => "167", … … 119 119 120 120 # standard font to plain text 121 %sftotxt = ("32" => " ", "33" => "!", "34" => "\"", "35" => "\#", "36" => "\$",121 my %sftotxt = ("32" => " ", "33" => "!", "34" => "\"", "35" => "\#", "36" => "\$", 122 122 "37" => "\%", "38" => "&", "39" => "'", "40" => "(", "41" => ")", 123 123 "42" => "*", "43" => "+", "44" => ",", "45" => "-", "46" => ".", -
trunk/gsdl/perllib/lang.pm
r537 r8716 29 29 package lang; 30 30 31 @ trans = (["ab", "Abkhazian"], ["om", "Afan Oromo"],31 @lang::trans = (["ab", "Abkhazian"], ["om", "Afan Oromo"], 32 32 ["om", "Oromo"], ["aa", "Afar"], 33 33 ["af", "Afrikaans"], ["sq", "Albanian"], … … 135 135 my $iso639 = ""; 136 136 137 foreach $lang (@trans) {137 foreach my $lang (@lang::trans) { 138 138 my $code = $lang->[0]; 139 139 my $enname = $lang->[1]; 140 if ($english =~ / \s*($code|$enname)\s*$/i) {140 if ($english =~ /^\s*($code|$enname)\s*$/i) { 141 141 # found the language 142 142 $iso639 = $code; … … 157 157 my @iso639list = (); 158 158 159 foreach $english (@englishlist) {159 foreach my $english (@englishlist) { 160 160 push (@iso639list, &one_english_to_iso639($english)); 161 161 } … … 169 169 my $english = ""; 170 170 171 foreach $lang (@trans) {171 foreach my $lang (@lang::trans) { 172 172 my $code = $lang->[0]; 173 173 my $enname = $lang->[1]; … … 180 180 } 181 181 182 return $en name;182 return $english; 183 183 } 184 184 -
trunk/gsdl/perllib/lucenebuilder.pm
r8072 r8716 31 31 32 32 sub BEGIN { 33 @ ISA = ('mgppbuilder');33 @lucenebuilder::ISA = ('mgppbuilder'); 34 34 } 35 35 -
trunk/gsdl/perllib/lucenebuildproc.pm
r8072 r8716 35 35 36 36 sub BEGIN { 37 @ ISA = ('mgppbuildproc');37 @lucenebuildproc::ISA = ('mgppbuildproc'); 38 38 } 39 39 -
trunk/gsdl/perllib/mgbuilder.pm
r8361 r8716 45 45 } 46 46 47 $maxdocsize = 12000;48 49 %wanted_index_files = ('td'=>1,47 my $maxdocsize = 12000; 48 49 my %wanted_index_files = ('td'=>1, 50 50 't'=>1, 51 51 'idb'=>1, … … 101 101 my $indexes = $self->{'collect_cfg'}->{'indexes'}; 102 102 $self->{'collect_cfg'}->{'indexes'} = []; 103 foreach $subcollection (@{$self->{'collect_cfg'}->{'indexsubcollections'}}) {104 foreach $index (@$indexes) {103 foreach my $subcollection (@{$self->{'collect_cfg'}->{'indexsubcollections'}}) { 104 foreach my $index (@$indexes) { 105 105 push (@{$self->{'collect_cfg'}->{'indexes'}}, "$index:$subcollection"); 106 106 } … … 112 112 my $indexes = $self->{'collect_cfg'}->{'indexes'}; 113 113 $self->{'collect_cfg'}->{'indexes'} = []; 114 foreach $language (@{$self->{'collect_cfg'}->{'languages'}}) {115 foreach $index (@$indexes) {114 foreach my $language (@{$self->{'collect_cfg'}->{'languages'}}) { 115 foreach my $index (@$indexes) { 116 116 if (defined ($self->{'collect_cfg'}->{'indexsubcollections'})) { 117 117 push (@{$self->{'collect_cfg'}->{'indexes'}}, "$index:$language"); … … 176 176 $self->{'dontgdbm'} = {}; 177 177 if (defined ($self->{'collect_cfg'}->{'dontgdbm'})) { 178 foreach $dg (@{$self->{'collect_cfg'}->{'dontgdbm'}}) {178 foreach my $dg (@{$self->{'collect_cfg'}->{'dontgdbm'}}) { 179 179 $self->{'dontgdbm'}->{$dg} = 1; 180 180 } … … 329 329 330 330 if (defined ($self->{'collect_cfg'}->{'dontbuild'})) { 331 foreach $checkstr (@{$self->{'collect_cfg'}->{'dontbuild'}}) {331 foreach my $checkstr (@{$self->{'collect_cfg'}->{'dontbuild'}}) { 332 332 if ($index =~ /^$checkstr$/) { 333 333 #push (@{$self->{'notbuilt'}}, $self->{'index_mapping'}->{$index}); … … 358 358 359 359 # build each of the indexes 360 foreach $index (@$indexes) {360 foreach my $index (@$indexes) { 361 361 if ($self->want_built($index)) { 362 362 print $outhandle "\n*** building index $index in subdirectory " . … … 384 384 my %dirnames = ('text'=>'text', 385 385 'extra'=>'extra'); 386 my %pnames = ('index' => '', 'subcollection' => '', 'languages' => '');387 388 foreach $index (@$indexes) {386 my %pnames = ('index' => {}, 'subcollection' => {}, 'languages' => {}); 387 388 foreach my $index (@$indexes) { 389 389 my ($level, $gran, $subcollection, $languages) = split (":", $index); 390 390 … … 434 434 } 435 435 $dirnames{$dirname} = $index; 436 $pnames{'index'} {$pindex} = "$level:$gran";437 $pnames{'subcollection'} {$psub} = $subcollection;438 $pnames{'languages'} {$plang} = $languages;436 $pnames{'index'}->{$pindex} = "$level:$gran"; 437 $pnames{'subcollection'}->{$psub} = $subcollection; 438 $pnames{'languages'}->{$plang} = $languages; 439 439 } 440 440 … … 554 554 @subcollections = split /,/, $subcollection if (defined $subcollection); 555 555 556 foreach $subcollection (@subcollections) {556 foreach my $subcollection (@subcollections) { 557 557 if (defined ($self->{'collect_cfg'}->{'subcollection'}->{$subcollection})) { 558 558 push (@$indexexparr, $self->{'collect_cfg'}->{'subcollection'}->{$subcollection}); … … 569 569 my @languages = (); 570 570 @languages = split /,/, $language if (defined $language); 571 foreach $language (@languages) {571 foreach my $language (@languages) { 572 572 my $not=0; 573 573 if ($language =~ s/^\!//) { … … 683 683 opendir (DIR, $tmpdir) || die 684 684 "mgbuilder::build_index - couldn't read directory $tmpdir\n"; 685 foreach $file (readdir(DIR)) {685 foreach my $file (readdir(DIR)) { 686 686 next if $file =~ /^\./; 687 687 my ($suffix) = $file =~ /\.([^\.]+)$/; … … 753 753 print $handle "[collection]\n"; 754 754 755 foreach $cmeta (keys (%{$self->{'collect_cfg'}->{'collectionmeta'}})) {755 foreach my $cmeta (keys (%{$self->{'collect_cfg'}->{'collectionmeta'}})) { 756 756 my $defaultfound=0; 757 757 my $first=1; … … 773 773 } 774 774 #iterate through the languages 775 foreach $lang (keys (%{$self->{'collect_cfg'}->{'collectionmeta'}->{$cmeta}})) {775 foreach my $lang (keys (%{$self->{'collect_cfg'}->{'collectionmeta'}->{$cmeta}})) { 776 776 if ($first) { 777 777 $first=0; … … 842 842 my $self = shift (@_); 843 843 my ($index); 844 my %build_cfg = ();844 my $build_cfg = {}; 845 845 my $outhandle = $self->{'outhandle'}; 846 846 … … 880 880 # the index map is used to determine what indexes there are, so any that are not built should not be put into the map. 881 881 my @indexmap = (); 882 foreach $index (@{$self->{'index_mapping'}->{'indexmaporder'}}) {882 foreach my $index (@{$self->{'index_mapping'}->{'indexmaporder'}}) { 883 883 if (not defined ($self->{'notbuilt'}->{$index})) { 884 884 push (@indexmap, "$index\-\>$self->{'index_mapping'}->{'indexmap'}->{$index}"); … … 888 888 889 889 my @subcollectionmap = (); 890 foreach $subcollection (@{$self->{'index_mapping'}->{'subcollectionmaporder'}}) {890 foreach my $subcollection (@{$self->{'index_mapping'}->{'subcollectionmaporder'}}) { 891 891 push (@subcollectionmap, "$subcollection\-\>" . 892 892 $self->{'index_mapping'}->{'subcollectionmap'}->{$subcollection}); … … 895 895 896 896 my @languagemap = (); 897 foreach $language (@{$self->{'index_mapping'}->{'languagemaporder'}}) {897 foreach my $language (@{$self->{'index_mapping'}->{'languagemaporder'}}) { 898 898 push (@languagemap, "$language\-\>" . 899 899 $self->{'index_mapping'}->{'languagemap'}->{$language}); … … 903 903 #$build_cfg->{'notbuilt'} = $self->{'notbuilt'} if scalar @{$self->{'notbuilt'}}; 904 904 my @notbuilt = (); 905 foreach $nb (keys %{$self->{'notbuilt'}}) {905 foreach my $nb (keys %{$self->{'notbuilt'}}) { 906 906 push (@notbuilt, $nb); 907 907 } -
trunk/gsdl/perllib/mgbuildproc.pm
r8402 r8716 38 38 39 39 BEGIN { 40 @ ISA = ('docproc');40 @mgbuildproc::ISA = ('docproc'); 41 41 } 42 42 … … 515 515 } else { 516 516 my $first = 1; 517 foreach $meta (@{$doc_obj->get_metadata ($section, $real_field)}) {517 foreach my $meta (@{$doc_obj->get_metadata ($section, $real_field)}) { 518 518 $meta =~ s/[\cB\cC]//g; 519 519 $self->{'num_processed_bytes'} += length ($meta); -
trunk/gsdl/perllib/mgppbuilder.pm
r8361 r8716 46 46 } 47 47 48 $maxdocsize = 12000;49 50 %level_map = ('document'=>'Doc',48 my $maxdocsize = 12000; 49 50 my %level_map = ('document'=>'Doc', 51 51 'section'=>'Sec', 52 52 'paragraph'=>'Para', … … 59 59 #$para_level = "Para"; 60 60 61 %wanted_index_files = ('td'=>1,61 my %wanted_index_files = ('td'=>1, 62 62 't'=>1, 63 63 'tl'=>1, … … 75 75 #add AND, OR, NOT NEAR to this list - these cannot be used as field names 76 76 #also add the level names (Doc, Sec, Para) 77 %static_indexfield_map = ('Title'=>'TI',77 my %static_indexfield_map = ('Title'=>'TI', 78 78 'TI'=>1, 79 79 'Subject'=>'SU', … … 112 112 my ($collection, $source_dir, $build_dir, $verbosity, 113 113 $maxdocs, $debug, $keepold, $remove_empty_classifications, 114 $outhandle, $no_text, $ gli) = @_;114 $outhandle, $no_text, $failhandle, $gli) = @_; 115 115 116 116 $outhandle = STDERR unless defined $outhandle; … … 153 153 my $indexes = $self->{'collect_cfg'}->{'indexes'}; 154 154 $self->{'collect_cfg'}->{'indexes'} = []; 155 foreach $subcollection (@{$self->{'collect_cfg'}->{'indexsubcollections'}}) {156 foreach $index (@$indexes) {155 foreach my $subcollection (@{$self->{'collect_cfg'}->{'indexsubcollections'}}) { 156 foreach my $index (@$indexes) { 157 157 push (@{$self->{'collect_cfg'}->{'indexes'}}, "$index:$subcollection"); 158 158 } … … 164 164 my $indexes = $self->{'collect_cfg'}->{'indexes'}; 165 165 $self->{'collect_cfg'}->{'indexes'} = []; 166 foreach $language (@{$self->{'collect_cfg'}->{'languages'}}) {167 foreach $index (@$indexes) {166 foreach my $language (@{$self->{'collect_cfg'}->{'languages'}}) { 167 foreach my $index (@$indexes) { 168 168 if (defined ($self->{'collect_cfg'}->{'indexsubcollections'})) { 169 169 push (@{$self->{'collect_cfg'}->{'indexes'}}, "$index:$language"); … … 193 193 $self->{'levelorder'} = (); 194 194 if (defined $self->{'collect_cfg'}->{'levels'}) { 195 foreach $level ( @{$self->{'collect_cfg'}->{'levels'}} ){195 foreach my $level ( @{$self->{'collect_cfg'}->{'levels'}} ){ 196 196 $level =~ tr/A-Z/a-z/; 197 197 $self->{'levels'}->{$level} = 1; … … 244 244 $self->{'dontgdbm'} = {}; 245 245 if (defined ($self->{'collect_cfg'}->{'dontgdbm'})) { 246 foreach $dg (@{$self->{'collect_cfg'}->{'dontgdbm'}}) {246 foreach my $dg (@{$self->{'collect_cfg'}->{'dontgdbm'}}) { 247 247 $self->{'dontgdbm'}->{$dg} = 1; 248 248 } … … 324 324 my ($doc_level) = $self->{'doc_level'}; 325 325 $mgpp_passes_sections .= "-J " . $level_map{$doc_level} . " "; 326 foreach $level (keys %{$self->{'levels'}}) {326 foreach my $level (keys %{$self->{'levels'}}) { 327 327 if ($level ne $doc_level && $level ne "paragraph") { 328 328 $mgpp_passes_sections .= "-K " . $level_map{$level} . " "; … … 419 419 420 420 if (defined ($self->{'collect_cfg'}->{'dontbuild'})) { 421 foreach $checkstr (@{$self->{'collect_cfg'}->{'dontbuild'}}) {421 foreach my $checkstr (@{$self->{'collect_cfg'}->{'dontbuild'}}) { 422 422 if ($index =~ /^$checkstr$/) { 423 423 #push (@{$self->{'notbuilt'}}, $self->{'index_mapping'}->{$index}); … … 448 448 449 449 # build each of the indexes 450 foreach $index (@$indexes) {450 foreach my $index (@$indexes) { 451 451 if ($self->want_built($index)) { 452 452 print $outhandle "\n*** building index $index in subdirectory " . … … 479 479 my %dirnames = ('text'=>'text', 480 480 'extra'=>'extra'); 481 my %pnames = ('index' => '', 'subcollection' => '', 'languages' => '');482 483 foreach $index (@$indexes) {481 my %pnames = ('index' => {}, 'subcollection' => {}, 'languages' => {}); 482 483 foreach my $index (@$indexes) { 484 484 my ($fields, $subcollection, $languages) = split (":", $index); 485 485 # the directory name starts with a processed version of index fields … … 487 487 #$pindex = lc ($pindex); 488 488 # now we only ever have one index, and its called 'idx' 489 $pindex = 'idx';489 my $pindex = 'idx'; 490 490 491 491 # next comes a processed version of the subcollection if there is one. … … 528 528 } 529 529 $dirnames{$dirname} = $index; 530 $pnames{'index'} {$pindex} = "$fields";531 $pnames{'subcollection'} {$psub} = $subcollection;532 $pnames{'languages'} {$plang} = $languages;530 $pnames{'index'}->{$pindex} = "$fields"; 531 $pnames{'subcollection'}->{$psub} = $subcollection; 532 $pnames{'languages'}->{$plang} = $languages; 533 533 } 534 534 … … 577 577 my $self = shift (@_); 578 578 my ($nameref) = @_; 579 579 my $num=0; 580 580 if ($$nameref =~ /(\d\d)$/) { 581 my$num = $1; $num ++;581 $num = $1; $num ++; 582 582 $$nameref =~ s/\d\d$/$num/; 583 583 } elsif ($$nameref =~ /(\d)$/) { 584 my$num = $1;584 $num = $1; 585 585 if ($num == 9) {$$nameref =~ s/\d\d$/10/;} 586 586 else {$num ++; $$nameref =~ s/\d$/$num/;} … … 616 616 $mgpp_passes_sections .= "-J " . $level_map{$doc_level} ." "; 617 617 618 foreach $level (keys %{$self->{'levels'}}) {618 foreach my $level (keys %{$self->{'levels'}}) { 619 619 if ($level ne $doc_level) { 620 620 $mgpp_passes_sections .= "-K " . $level_map{$level}. " "; … … 779 779 opendir (DIR, $tmpdir) || die 780 780 "mgppbuilder::build_index - couldn't read directory $tmpdir\n"; 781 foreach $file (readdir(DIR)) {781 foreach my $file (readdir(DIR)) { 782 782 next if $file =~ /^\./; 783 783 my ($suffix) = $file =~ /\.([^\.]+)$/; … … 854 854 if (defined $self->{'collect_cfg'}->{'collectionmeta'}) { 855 855 $collmetadefined = 1; 856 foreach $cmeta (keys (%{$self->{'collect_cfg'}->{'collectionmeta'}})) {856 foreach my $cmeta (keys (%{$self->{'collect_cfg'}->{'collectionmeta'}})) { 857 857 next if ($cmeta =~ /^\./); # for now, ignore ones with dots 858 858 my ($metadata_entry) = $self->create_language_db_map($cmeta, $cmeta); … … 866 866 # <SU>Subject 867 867 # these now come from collection meta. if that is not defined, usses the metadata name 868 $field_entry=""; 869 foreach $longfield (@{$self->{'build_cfg'}->{'indexfields'}}){ 870 $shortfield = $self->{'buildproc'}->{'indexfieldmap'}->{$longfield}; 868 my $field_entry=""; 869 my $collmeta = ""; 870 foreach my $longfield (@{$self->{'build_cfg'}->{'indexfields'}}){ 871 my $shortfield = $self->{'buildproc'}->{'indexfieldmap'}->{$longfield}; 871 872 next if $shortfield eq 1; 872 873 873 874 # we need to check if some coll meta has been defined 874 my$collmeta = ".$longfield";875 $collmeta = ".$longfield"; 875 876 if ($collmetadefined && defined $self->{'collect_cfg'}->{'collectionmeta'}->{$collmeta}) { 876 $metadata_entry = $self->create_language_db_map($collmeta, $shortfield);877 my $metadata_entry = $self->create_language_db_map($collmeta, $shortfield); 877 878 $field_entry .= $metadata_entry; 878 879 } else { #use the metadata names, or the text macros for allfields and textonly … … 889 890 890 891 # now add the level names 891 $level_entry = "";892 foreach $level (@{$self->{'collect_cfg'}->{'levels'}}) {893 my$collmeta = ".$level"; # based on the original specification892 my $level_entry = ""; 893 foreach my $level (@{$self->{'collect_cfg'}->{'levels'}}) { 894 $collmeta = ".$level"; # based on the original specification 894 895 $level =~ tr/A-Z/a-z/; # make it lower case 895 896 my $levelid = $level_map{$level}; # find the actual value we used in the index 896 897 if ($collmetadefined && defined $self->{'collect_cfg'}->{'collectionmeta'}->{$collmeta}) { 897 $metadata_entry = $self->create_language_db_map($collmeta, $levelid);898 my $metadata_entry = $self->create_language_db_map($collmeta, $levelid); 898 899 $level_entry .= $metadata_entry; 899 900 } else { … … 905 906 906 907 # now add subcoll meta 907 $subcoll_entry = ""; 908 foreach $subcoll (@{$self->{'index_mapping'}->{'subcollectionmaporder'}}) { 908 my $subcoll_entry = ""; 909 my $shortname = ""; 910 my $one_entry = ""; 911 foreach my $subcoll (@{$self->{'index_mapping'}->{'subcollectionmaporder'}}) { 909 912 if (defined $self->{'collect_cfg'}->{'collectionmeta'}->{".$subcoll"}) { 910 my$shortname = $self->{'index_mapping'}->{$subcoll};913 $shortname = $self->{'index_mapping'}->{$subcoll}; 911 914 $one_entry = $self->create_language_db_map(".$subcoll", $shortname); 912 915 $subcoll_entry .= $one_entry; … … 917 920 print $handle $subcoll_entry; 918 921 # now add language meta 919 $lang_entry = "";920 foreach $lang (@{$self->{'index_mapping'}->{'languagemaporder'}}) {922 my $lang_entry = ""; 923 foreach my $lang (@{$self->{'index_mapping'}->{'languagemaporder'}}) { 921 924 if (defined $self->{'collect_cfg'}->{'collectionmeta'}->{".$lang"}) { 922 my$shortname = $self->{'index_mapping'}->{$lang};925 $shortname = $self->{'index_mapping'}->{$lang}; 923 926 $one_entry = $self->create_language_db_map(".$lang", $shortname); 924 927 $lang_entry .= $one_entry; … … 965 968 my $default=""; 966 969 #iterate through the languages 967 foreach $lang (keys (%{$self->{'collect_cfg'}->{'collectionmeta'}->{$metaname}})) {970 foreach my $lang (keys (%{$self->{'collect_cfg'}->{'collectionmeta'}->{$metaname}})) { 968 971 if ($first) { 969 972 $first=0; … … 1016 1019 my @specifiedfieldorder = (); 1017 1020 # go through the index definition and add each thing to a map, so we can easily check if it is already specified - when doing the metadata, we print out all the individual fields, but some may already be specified in the index definition, so we dont want to add those again. 1018 foreach $field (@{$self->{'collect_cfg'}->{'indexes'}}) {1021 foreach my $field (@{$self->{'collect_cfg'}->{'indexes'}}) { 1019 1022 # remove subcoll stuff 1020 1023 my $parts = $field; 1021 1024 $parts =~ s/:.*$//; 1022 1025 my @fs = split(',', $parts); 1023 foreach $f(@fs) {1026 foreach my $f(@fs) { 1024 1027 if (!defined $specifiedfields->{$f}) { 1025 1028 $specifiedfields->{$f}=1; … … 1030 1033 1031 1034 #add all fields bit 1032 foreach $field (@specifiedfieldorder) {1035 foreach my $field (@specifiedfieldorder) { 1033 1036 if ($field eq "metadata") { 1034 foreach $newfield (keys %{$self->{'buildproc'}->{'indexfields'}}) {1037 foreach my $newfield (keys %{$self->{'buildproc'}->{'indexfields'}}) { 1035 1038 if (!defined $specifiedfields->{$newfield}) { 1036 1039 push (@indexfieldmap, "$newfield\-\>$self->{'buildproc'}->{'indexfieldmap'}->{$newfield}"); … … 1070 1073 } 1071 1074 # we read the stuff in from the build.cfg file - if its there 1072 $buildconfigfile = &util::filename_cat($self->{'build_dir'}, "build.cfg");1075 my $buildconfigfile = &util::filename_cat($self->{'build_dir'}, "build.cfg"); 1073 1076 1074 1077 if (!-e $buildconfigfile) { … … 1080 1083 } 1081 1084 } 1082 $buildcfg = &colcfg::read_build_cfg( $buildconfigfile);1085 my $buildcfg = &colcfg::read_build_cfg( $buildconfigfile); 1083 1086 if (defined $buildcfg->{'indexfields'}) { 1084 foreach $field (@{$buildcfg->{'indexfields'}}) {1087 foreach my $field (@{$buildcfg->{'indexfields'}}) { 1085 1088 push (@indexfields, "$field"); 1086 1089 } 1087 1090 } 1088 1091 if (defined $buildcfg->{'indexfieldmap'}) { 1089 foreach $field (@{$buildcfg->{'indexfieldmap'}}) {1092 foreach my $field (@{$buildcfg->{'indexfieldmap'}}) { 1090 1093 push (@indexfieldmap, "$field"); 1091 ($f, $v) = $field =~ /^(.*)\-\>(.*)$/;1094 my ($f, $v) = $field =~ /^(.*)\-\>(.*)$/; 1092 1095 $self->{'buildproc'}->{'indexfieldmap'}->{$f} = $v; 1093 1096 } … … 1122 1125 # store the level info 1123 1126 my @indexlevels = (); 1124 foreach $l (@{$self->{'levelorder'}}) {1127 foreach my $l (@{$self->{'levelorder'}}) { 1125 1128 push (@indexlevels, $level_map{$l}); 1126 1129 } … … 1138 1141 # store the mapping between the index names and the directory names 1139 1142 my @indexmap = (); 1140 foreach $index (@{$self->{'index_mapping'}->{'indexmaporder'}}) {1143 foreach my $index (@{$self->{'index_mapping'}->{'indexmaporder'}}) { 1141 1144 if (not defined ($self->{'notbuilt'}->{$index})) { 1142 1145 push (@indexmap, "$index\-\>$self->{'index_mapping'}->{'indexmap'}->{$index}"); … … 1146 1149 1147 1150 my @subcollectionmap = (); 1148 foreach $subcollection (@{$self->{'index_mapping'}->{'subcollectionmaporder'}}) {1151 foreach my $subcollection (@{$self->{'index_mapping'}->{'subcollectionmaporder'}}) { 1149 1152 push (@subcollectionmap, "$subcollection\-\>" . 1150 1153 $self->{'index_mapping'}->{'subcollectionmap'}->{$subcollection}); … … 1153 1156 1154 1157 my @languagemap = (); 1155 foreach $language (@{$self->{'index_mapping'}->{'languagemaporder'}}) {1158 foreach my $language (@{$self->{'index_mapping'}->{'languagemaporder'}}) { 1156 1159 push (@languagemap, "$language\-\>" . 1157 1160 $self->{'index_mapping'}->{'languagemap'}->{$language}); … … 1161 1164 #$build_cfg->{'notbuilt'} = $self->{'notbuilt'}; 1162 1165 my @notbuilt = (); 1163 foreach $nb (keys %{$self->{'notbuilt'}}) {1166 foreach my $nb (keys %{$self->{'notbuilt'}}) { 1164 1167 push (@notbuilt, $nb); 1165 1168 } -
trunk/gsdl/perllib/mgppbuildproc.pm
r8402 r8716 39 39 40 40 BEGIN { 41 @ ISA = ('docproc');41 @mgppbuildproc::ISA = ('docproc'); 42 42 } 43 43 44 44 #this must be the same as in mgppbuilder 45 %level_map = ('document'=>'Doc',45 my %level_map = ('document'=>'Doc', 46 46 'section'=>'Sec', 47 47 'paragraph'=>'Para'); … … 418 418 print $handle "<contains>"; 419 419 my $firstchild = 1; 420 foreach $child (@$children) {420 foreach my $child (@$children) { 421 421 print $handle ";" unless $firstchild; 422 422 $firstchild = 0; … … 485 485 while ($text =~ /<([^>]*)>/ && $text ne "") { 486 486 487 $tag = $1;487 my $tag = $1; 488 488 $outtext .= $`." "; #add everything before the matched tag 489 489 $text = $'; #everything after the matched tag … … 632 632 my $shortname = ""; 633 633 my $metadata = $doc_obj->get_all_metadata ($section); 634 foreach $pair (@$metadata) {634 foreach my $pair (@$metadata) { 635 635 my ($mfield, $mvalue) = (@$pair); 636 636 # check fields here, maybe others dont want - change to use dontindex!! … … 670 670 $self->{'indexfieldmap'}->{$shortname} = 1; 671 671 } 672 foreach $item (@{$doc_obj->get_metadata ($section, $real_field)}) {672 foreach my $item (@{$doc_obj->get_metadata ($section, $real_field)}) { 673 673 $new_text .= "$paratag<$shortname>$item</$shortname>\n"; 674 674 } … … 695 695 #now ignores non-letdig characters 696 696 sub create_shortname { 697 $self = shift(@_);697 my $self = shift(@_); 698 698 699 699 my ($realname) = @_; … … 710 710 711 711 #if already used, take the first and third letdigs and so on 712 $count = 1;712 my $count = 1; 713 713 while (defined $self->{'indexfieldmap'}->{$shortname}) { 714 714 if ($realname =~ /^[^\w]*(\w)([^\w]*\w){$count}[^\w]*(\w)/) { -
trunk/gsdl/perllib/parsargv.pm
r2359 r8716 66 66 67 67 68 68 sub parse 69 69 { 70 70 my $arglist = shift; … … 95 95 96 96 die "Variable for $spec is not a valid type." 97 unless ref($var) eq 'SCALAR' || ref($var) eq 'ARRAY'; 97 unless ref($var) eq 'SCALAR' || ref($var) eq 'ARRAY' 98 || (ref($var) eq 'REF' && ref($$var) eq 'GLOB'); 98 99 99 100 my $delimiter; -
trunk/gsdl/perllib/plugins/ArcPlug.pm
r6408 r8716 39 39 40 40 BEGIN { 41 @ ISA = ('BasPlug');41 @ArcPlug::ISA = ('BasPlug'); 42 42 } 43 43 -
trunk/gsdl/perllib/plugins/BasPlug.pm
r8678 r8716 143 143 sub get_arguments 144 144 { 145 local$self = shift(@_);146 local$optionlistref = $self->{'option_list'};147 local@optionlist = @$optionlistref;148 local$pluginoptions = pop(@$optionlistref);149 local$pluginarguments = $pluginoptions->{'args'};145 my $self = shift(@_); 146 my $optionlistref = $self->{'option_list'}; 147 my @optionlist = @$optionlistref; 148 my $pluginoptions = pop(@$optionlistref); 149 my $pluginarguments = $pluginoptions->{'args'}; 150 150 return $pluginarguments; 151 151 } … … 154 154 sub print_xml_usage 155 155 { 156 local$self = shift(@_);156 my $self = shift(@_); 157 157 158 158 # XML output is always in UTF-8 … … 166 166 sub print_xml 167 167 { 168 local$self = shift(@_);169 170 local$optionlistref = $self->{'option_list'};171 local@optionlist = @$optionlistref;172 local$pluginoptions = pop(@$optionlistref);168 my $self = shift(@_); 169 170 my $optionlistref = $self->{'option_list'}; 171 my @optionlist = @$optionlistref; 172 my $pluginoptions = pop(@$optionlistref); 173 173 return if (!defined($pluginoptions)); 174 174 … … 197 197 sub print_txt_usage 198 198 { 199 local$self = shift(@_);199 my $self = shift(@_); 200 200 201 201 # Print the usage message for a plugin (recursively) 202 local$descoffset = $self->determine_description_offset(0);202 my $descoffset = $self->determine_description_offset(0); 203 203 $self->print_plugin_usage($descoffset, 1); 204 204 } … … 207 207 sub determine_description_offset 208 208 { 209 local$self = shift(@_);210 local$maxoffset = shift(@_);211 212 local$optionlistref = $self->{'option_list'};213 local@optionlist = @$optionlistref;214 local$pluginoptions = pop(@$optionlistref);209 my $self = shift(@_); 210 my $maxoffset = shift(@_); 211 212 my $optionlistref = $self->{'option_list'}; 213 my @optionlist = @$optionlistref; 214 my $pluginoptions = pop(@$optionlistref); 215 215 return $maxoffset if (!defined($pluginoptions)); 216 216 217 217 # Find the length of the longest option string of this plugin 218 local$pluginargs = $pluginoptions->{'args'};218 my $pluginargs = $pluginoptions->{'args'}; 219 219 if (defined($pluginargs)) { 220 local$longest = &PrintUsage::find_longest_option_string($pluginargs);220 my $longest = &PrintUsage::find_longest_option_string($pluginargs); 221 221 if ($longest > $maxoffset) { 222 222 $maxoffset = $longest; … … 233 233 sub print_plugin_usage 234 234 { 235 local$self = shift(@_);236 local$descoffset = shift(@_);237 local$isleafclass = shift(@_);238 239 local$optionlistref = $self->{'option_list'};240 local@optionlist = @$optionlistref;241 local$pluginoptions = pop(@$optionlistref);235 my $self = shift(@_); 236 my $descoffset = shift(@_); 237 my $isleafclass = shift(@_); 238 239 my $optionlistref = $self->{'option_list'}; 240 my @optionlist = @$optionlistref; 241 my $pluginoptions = pop(@$optionlistref); 242 242 return if (!defined($pluginoptions)); 243 243 244 local$pluginname = $pluginoptions->{'name'};245 local$pluginargs = $pluginoptions->{'args'};246 local$plugindesc = $pluginoptions->{'desc'};244 my $pluginname = $pluginoptions->{'name'}; 245 my $pluginargs = $pluginoptions->{'args'}; 246 my $plugindesc = $pluginoptions->{'desc'}; 247 247 248 248 # Produce the usage information using the data structure above … … 257 257 if (defined($pluginargs)) { 258 258 # Calculate the column offset of the option descriptions 259 local$optiondescoffset = $descoffset + 2; # 2 spaces between options & descriptions259 my $optiondescoffset = $descoffset + 2; # 2 spaces between options & descriptions 260 260 261 261 if ($isleafclass) { … … 486 486 487 487 $self->extra_metadata ($doc_obj, $doc_obj->get_top_section(), $metadata); 488 488 489 489 # do plugin specific processing of doc_obj 490 return -1 unless defined ($self->process (\$text, $pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli)); 491 490 unless (defined ($self->process (\$text, $pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli))) { 491 $text = ''; 492 undef $text; 493 return -1; 494 } 495 $text=''; 496 undef $text; 497 492 498 # do any automatic metadata extraction 493 499 $self->auto_extract_metadata ($doc_obj); … … 495 501 # add an OID 496 502 # see if there is a plugin-specific set_OID function... 497 if (defined ($self->can( set_OID))) {503 if (defined ($self->can('set_OID'))) { 498 504 # it will need $doc_obj to set the Identifier metadata... 499 505 $self->set_OID($doc_obj); … … 507 513 508 514 $self->{'num_processed'} ++; 509 515 undef $doc_obj; 510 516 return 1; # processed the file 511 517 } -
trunk/gsdl/perllib/plugins/GAPlug.pm
r7900 r8716 29 29 # to their DTD. 30 30 31 # 12/05/02 Added usage datastructure - John Thompson32 33 31 package GAPlug; 34 32 … … 36 34 37 35 sub BEGIN { 38 @ ISA = ('XMLPlug');36 @GAPlug::ISA = ('XMLPlug'); 39 37 } 40 38 -
trunk/gsdl/perllib/plugins/HTMLPlug.pm
r8668 r8716 45 45 46 46 sub BEGIN { 47 @ ISA = ('BasPlug');47 @HTMLPlug::ISA = ('BasPlug'); 48 48 } 49 49 -
trunk/gsdl/perllib/plugins/OAIPlug.pm
r8684 r8716 33 33 34 34 sub BEGIN { 35 @ ISA = ('BasPlug');35 @OAIPlug::ISA = ('BasPlug'); 36 36 } 37 37 -
trunk/gsdl/perllib/plugins/PDFPlug.pm
r8278 r8716 31 31 use unicode; 32 32 33 sub BEGIN { 33 34 @PDFPlug::ISA = ('ConvertToPlug'); 35 } 34 36 35 37 my $arguments = -
trunk/gsdl/perllib/plugins/RecPlug.pm
r8512 r8716 100 100 101 101 BEGIN { 102 @ ISA = ('BasPlug');102 @RecPlug::ISA = ('BasPlug'); 103 103 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan"); 104 104 } … … 238 238 239 239 # Re-order the files in the list so any directories ending with .all are moved to the end 240 for ( $i = scalar(@dir) - 1; $i >= 0; $i--) {240 for (my $i = scalar(@dir) - 1; $i >= 0; $i--) { 241 241 if (-d &util::filename_cat($dirname, $dir[$i]) && $dir[$i] =~ /\.all$/) { 242 242 push(@dir, splice(@dir, $i, 1)); … … 302 302 303 303 # Any new files are added to the end of @dir to get processed by the loop 304 my $j; 304 305 foreach my $subfilenow (@dirnow) { 305 306 for ($j = 0; $j < $num_files; $j++) { -
trunk/gsdl/perllib/plugins/SplitPlug.pm
r8121 r8716 41 41 42 42 use BasPlug; 43 # SplitPlug is a sub-class of BasPlug.44 @SplitPlug::ISA = ('BasPlug');45 43 use gsprintf 'gsprintf'; 46 44 use util; 47 45 46 # SplitPlug is a sub-class of BasPlug. 47 sub BEGIN { 48 @SplitPlug::ISA = ('BasPlug'); 49 } 48 50 49 51 -
trunk/gsdl/perllib/plugins/UnknownPlug.pm
r8519 r8716 61 61 62 62 sub BEGIN { 63 @ ISA = ('BasPlug');63 @UnknownPlug::ISA = ('BasPlug'); 64 64 } 65 65 -
trunk/gsdl/perllib/plugins/XMLPlug.pm
r8121 r8716 30 30 31 31 sub BEGIN { 32 @ ISA = ('BasPlug');32 @XMLPlug::ISA = ('BasPlug'); 33 33 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan"); 34 34 } … … 232 232 sub close_document { 233 233 my $self = shift(@_); 234 234 my $doc_obj = $self->{'doc_obj'}; 235 235 # include any metadata passed in from previous plugins 236 236 # note that this metadata is associated with the top level section 237 $self->extra_metadata ($ self->{'doc_obj'},238 $ self->{'doc_obj'}->get_top_section(),237 $self->extra_metadata ($doc_obj, 238 $doc_obj->get_top_section(), 239 239 $self->{'metadata'}); 240 240 241 241 # do any automatic metadata extraction 242 $self->auto_extract_metadata ($ self->{'doc_obj'});242 $self->auto_extract_metadata ($doc_obj); 243 243 244 244 # add an OID 245 $ self->{'doc_obj'}->set_OID();245 $doc_obj->set_OID(); 246 246 247 247 $doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "Plugin", "$self->{'plugin_type'}"); … … 249 249 250 250 # process the document 251 $self->{'processor'}->process($ self->{'doc_obj'});251 $self->{'processor'}->process($doc_obj); 252 252 253 253 $self->{'num_processed'} ++; -
trunk/gsdl/perllib/printusage.pm
r7023 r8716 82 82 my $options = shift(@_); 83 83 84 foreach $option (@$options) {84 foreach my $option (@$options) { 85 85 my $optionname = $option->{'name'}; 86 86 my $optiondesc = &gsprintf::lookup_string($option->{'desc'}); … … 110 110 &gsprintf(STDERR, " <List>\n"); 111 111 my $optionvalueslist = $option->{'list'}; 112 foreach $optionvalue (@$optionvalueslist) {112 foreach my $optionvalue (@$optionvalueslist) { 113 113 &gsprintf(STDERR, " <Value>\n"); 114 114 &gsprintf(STDERR, " <Name>$optionvalue->{'name'}</Name>\n"); … … 128 128 if ($optionname =~ m/^input_encoding$/i) { 129 129 my $e = $encodings::encodings; 130 foreach $enc (sort {$e->{$a}->{'name'} cmp $e->{$b}->{'name'}} keys (%$e)) {130 foreach my $enc (sort {$e->{$a}->{'name'} cmp $e->{$b}->{'name'}} keys (%$e)) { 131 131 &gsprintf(STDERR, " <Value>\n"); 132 132 &gsprintf(STDERR, " <Name>$enc</Name>\n"); … … 203 203 my $optiondescoffset = shift(@_); 204 204 205 foreach $option (@$options) {205 foreach my $option (@$options) { 206 206 # Display option name 207 207 my $optionname = $option->{'name'}; … … 235 235 if (defined($optionvalueslist)) { 236 236 &gsprintf(STDERR, "\n"); 237 foreach $optionvalue (@$optionvalueslist) {237 foreach my $optionvalue (@$optionvalueslist) { 238 238 my $optionvaluename = $optionvalue->{'name'}; 239 239 &gsprintf(STDERR, " " x $optiondescoffset); … … 249 249 if ($optionname =~ m/^input_encoding$/i) { 250 250 my $e = $encodings::encodings; 251 foreach $enc (sort {$e->{$a}->{'name'} cmp $e->{$b}->{'name'}} keys (%$e)) {251 foreach my $enc (sort {$e->{$a}->{'name'} cmp $e->{$b}->{'name'}} keys (%$e)) { 252 252 &gsprintf(STDERR, " " x $optiondescoffset); 253 253 &gsprintf(STDERR, "$enc:"); … … 284 284 my @words = split(/ /, $text); 285 285 286 foreach $word (@words) {286 foreach my $word (@words) { 287 287 # If printing this word would exceed the column end, start a new line 288 288 if (($linelength + length($word)) >= $columnend) { … … 306 306 307 307 my $maxlength = 0; 308 foreach $option (@$options) {308 foreach my $option (@$options) { 309 309 my $optionname = $option->{'name'}; 310 310 my $optiontype = $option->{'type'}; -
trunk/gsdl/perllib/remproc.pm
r537 r8716 31 31 32 32 BEGIN { 33 @ ISA = ('docproc');33 @remproc::ISA = ('docproc'); 34 34 } 35 35 -
trunk/gsdl/perllib/strings.rb
r8679 r8716 405 405 DateList.metadata:The metadata that contains the dates to classify by. The format is expected to be yyyymmdd. 406 406 407 DateList. newest_first:Sort the documents in reverse chronological order (newest first).407 DateList.reverse_sort:Sort the documents in reverse chronological order (newest first). 408 408 409 409 DateList.nogroup:Make each year an individual entry in the horizontal list, instead of spanning years with few entries. (This can also be used with the -bymonth option to make each month a separate entry instead of merging). … … 419 419 Hierarchy.metadata:Metadata field used for classification. List will be sorted by this element, unless -sort is used. 420 420 421 Hierarchy.reverse_sort:Sort leaf nodes in reverse order (use with -sort). 421 422 Hierarchy.sort:Metadata field to sort by. Use '-sort nosort' for no sorting. 422 423 -
trunk/gsdl/perllib/unicode.pm
r8217 r8716 90 90 my $out = ""; 91 91 92 foreach $num (@$in) {92 foreach my $num (@$in) { 93 93 next unless defined $num; 94 94 if ($num < 0x80) { … … 120 120 my $i = 0; 121 121 my ($c1, $c2, $c3); 122 $len = length($in);122 my $len = length($in); 123 123 while ($i < $len) { 124 124 if (($c1 = ord(substr ($in, $i, 1))) < 0x80) { … … 171 171 my $out = ""; 172 172 173 foreach $num (@$in) {173 foreach my $num (@$in) { 174 174 $out .= chr (($num & 0xff00) >> 8); 175 175 $out .= chr ($num & 0xff); … … 219 219 } 220 220 221 if ($ translations{$encodename}->{'count'} == 1) {221 if ($unicode::translations{$encodename}->{'count'} == 1) { 222 222 return &singlebyte2unicode ($encodename, $textref); 223 223 } else { … … 364 364 my $low = $from % 256; 365 365 366 return 0 unless defined $ translations{$encoding};367 368 my $block = $ translations{$encoding}->{'map'};366 return 0 unless defined $unicode::translations{$encoding}; 367 368 my $block = $unicode::translations{$encoding}->{'map'}; 369 369 370 370 if (ref ($block->[$high]) ne "ARRAY") { … … 382 382 # value. This data structure aims to allow fast translation and 383 383 # efficient storage. 384 % translations = ();384 %unicode::translations = (); 385 385 386 386 # @array256 is used for initialisation, there must be 387 387 # a better way... 388 388 # What about this?: @array256 = (0) x 256; 389 @ array256 = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,389 @unicode::array256 = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 390 390 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 391 391 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, … … 409 409 410 410 # check to see if the encoding has already been loaded 411 return 1 if (defined $ translations{$encoding});411 return 1 if (defined $unicode::translations{$encoding}); 412 412 413 413 return 0 unless open (MAPFILE, $mapfile); 414 414 binmode (MAPFILE); 415 415 416 $ translations{$encoding} = {'map' => [@array256], 'count' => 0};417 my $block = $ translations{$encoding};416 $unicode::translations{$encoding} = {'map' => [@unicode::array256], 'count' => 0}; 417 my $block = $unicode::translations{$encoding}; 418 418 419 419 my ($in,$i,$j); 420 420 while (read(MAPFILE, $in, 1) == 1) { 421 421 $i = unpack ("C", $in); 422 $block->{'map'}->[$i] = [@ array256];422 $block->{'map'}->[$i] = [@unicode::array256]; 423 423 for ($j=0; $j<256 && read(MAPFILE, $in, 2)==2; $j++) { 424 424 my ($n1, $n2) = unpack ("CC", $in); -
trunk/gsdl/perllib/util.pm
r8682 r8716 37 37 # make sure the files we want to delete exist 38 38 # and are regular files 39 foreach $file (@files) {39 foreach my$file (@files) { 40 40 if (!-e $file) { 41 41 print STDERR "util::rm $file does not exist\n"; … … 62 62 63 63 # recursively remove the files 64 foreach $file (@files) {64 foreach my $file (@files) { 65 65 $file =~ s/[\/\\]+$//; # remove trailing slashes 66 66 … … 112 112 113 113 # move the files 114 foreach $file (@srcfiles) {114 foreach my $file (@srcfiles) { 115 115 my $tempdest = $dest; 116 116 if (-d $tempdest) { … … 147 147 148 148 # copy the files 149 foreach $file (@srcfiles) {149 foreach my $file (@srcfiles) { 150 150 my $tempdest = $dest; 151 151 if (-d $tempdest) { … … 190 190 191 191 # copy the files 192 foreach $file (@srcfiles) {192 foreach my $file (@srcfiles) { 193 193 194 194 if (!-e $file) { … … 209 209 my @filedir = readdir (INDIR); 210 210 closedir (INDIR); 211 foreach $f (@filedir) {211 foreach my $f (@filedir) { 212 212 next if $f =~ /^\.\.?$/; 213 213 # copy all the files in this directory … … 252 252 my $dirsofar = ""; 253 253 my $first = 1; 254 foreach $dirname (split ("/", $dir)) {254 foreach my $dirname (split ("/", $dir)) { 255 255 $dirsofar .= "/" unless $first; 256 256 $first = 0; … … 442 442 } 443 443 444 @file1stat = stat ($file1);445 @file2stat = stat ($file2);444 my @file1stat = stat ($file1); 445 my @file2stat = stat ($file2); 446 446 447 447 if (-d $file1) {
Note:
See TracChangeset
for help on using the changeset viewer.