Changeset 10254
- Timestamp:
- 2005-07-19T16:27:51+12:00 (19 years ago)
- Location:
- trunk/gsdl/perllib/plugins
- Files:
-
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugins/ArcPlug.pm
r10218 r10254 38 38 use gsprintf; 39 39 40 use strict; 41 no strict 'refs'; # allow filehandles to be variables and viceversa 42 40 43 BEGIN { 41 44 @ArcPlug::ISA = ('BasPlug'); 42 45 } 46 47 my $arguments = [ 48 ]; 43 49 44 50 my $options = { 'name' => "ArcPlug", … … 46 52 'abstract' => "no", 47 53 'inherits' => "yes" }; 48 54 49 55 sub gsprintf 50 56 { … … 57 63 push(@$pluginlist, $class); 58 64 59 if(defined $arguments){ print "SETSEGE\n";push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}65 if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});} 60 66 if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)}; 61 67 … … 79 85 foreach my $subfile (@$file_list) { 80 86 my $doc_oid = $subfile->[1]; 81 $index_status = $archive_info->get_status_info($doc_oid); 87 # why do we get this when it is not used??? 88 my $index_status = $archive_info->get_status_info($doc_oid); 82 89 $archive_info->set_status_info($doc_oid,"B"); 83 90 } … … 133 140 my $doc_oid = $subfile->[1]; 134 141 135 $index_status = $archive_info->get_status_info($doc_oid);142 my $index_status = $archive_info->get_status_info($doc_oid); 136 143 137 144 my $processor_mode = $processor->get_mode(); -
trunk/gsdl/perllib/plugins/BNContentePlug.pm
r10218 r10254 37 37 use XMLParser; 38 38 use XML::Parser; 39 40 use strict; 41 no strict 'refs'; # allow filehandles to be variables and viceversa 39 42 40 43 sub BEGIN { -
trunk/gsdl/perllib/plugins/BasPlug.pm
r10229 r10254 36 36 $SIG{__WARN__} = sub {warn($_[0]) unless ($_[0] =~ /Subroutine\s+\S+\sredefined/)}; 37 37 38 use strict; no strict 'subs'; 38 use strict; 39 no strict 'subs'; 40 no strict 'refs'; # allow filehandles to be variables and viceversa 39 41 40 42 use File::Basename; -
trunk/gsdl/perllib/plugins/BibTexPlug.pm
r10218 r10254 45 45 46 46 use SplitPlug; 47 use strict; 48 no strict 'refs'; # allow filehandles to be variables and viceversa 47 49 48 50 # BibTexPlug is a sub-class of BasPlug. 49 51 sub BEGIN { 50 @ ISA = ('SplitPlug');52 @BibTexPlug::ISA = ('SplitPlug'); 51 53 } 52 54 … … 103 105 my $outhandle = $self->{'outhandle'}; 104 106 107 my $cursection = $doc_obj->get_top_section(); 105 108 $self->{'key'} = "default"; 106 109 -
trunk/gsdl/perllib/plugins/BookPlug.pm
r10218 r10254 55 55 use BasPlug; 56 56 use util; 57 use strict; 58 no strict 'refs'; # allow filehandles to be variables and viceversa 57 59 58 60 sub BEGIN { 59 @ ISA = ('BasPlug');61 @BookPlug::ISA = ('BasPlug'); 60 62 } 61 63 … … 197 199 198 200 sub replace_image_links { 201 my $self = shift (@_); 199 202 my ($dir, $doc_obj, $front, $link, $back) = @_; 200 203 my $outhandle = $self->{'outhandle'}; -
trunk/gsdl/perllib/plugins/ConvertToPlug.pm
r10218 r10254 43 43 use ghtml; 44 44 45 use strict; 46 no strict 'refs'; # allow filehandles to be variables and viceversa 47 45 48 sub BEGIN { 46 @ ISA = ('HTMLPlug');49 @ConvertToPlug::ISA = ('HTMLPlug'); 47 50 # @ISA = ('HTMLPlug', 'TEXTPlug'); 48 51 # @ISA = ('BasPlug'); #, 'HTMLPlug', 'TEXTPlug'); -
trunk/gsdl/perllib/plugins/ConvertToRogPlug.pm
r10218 r10254 30 30 use BasPlug; 31 31 use RogPlug; 32 32 use strict; 33 no strict 'refs'; # allow filehandles to be variables and viceversa 33 34 34 35 sub BEGIN { 35 @ISA = ('RogPlug'); 36 } 37 36 @ConvertToRogPlug::ISA = ('RogPlug'); 37 } 38 39 my $arguments = [ 40 ]; 38 41 my $options = { 'name' => "ConvertToRogPlug", 39 42 'desc' => "{ConvertToRogPlug.desc}", 40 43 'abstract' => "yes", 41 44 'inherits' => "yes" }; 42 43 44 sub parse_args45 {46 my $class = shift (@_);47 my ($args) = @_;48 49 my $plugin_name = $class;50 $plugin_name =~ s/\.pm$//;51 52 if (!parsargv::parse($args,53 "allow_extra_options")) {54 55 print STDERR "\nIncorrect options passed to $plugin_name, ";56 print STDERR "check your collect.cfg configuration file\n";57 $self->print_txt_usage(""); # Use default resource bundle58 die "\n";59 }60 61 return ($plugin_name);62 }63 45 64 46 sub new { … … 312 294 $doc_obj->add_metadata($cursection, "TVal", $song->{'tval'}); 313 295 314 foreach $md ( @{$song->{'metadata'}} )296 foreach my $md ( @{$song->{'metadata'}} ) 315 297 { 316 298 $doc_obj->add_metadata($cursection, $md->[0], $md->[1]); -
trunk/gsdl/perllib/plugins/DSpacePlug.pm
r10218 r10254 52 52 #use ghtml; 53 53 use XMLParser; 54 use strict; 55 no strict 'refs'; # allow filehandles to be variables and viceversa 54 56 55 57 sub BEGIN { -
trunk/gsdl/perllib/plugins/EMAILPlug.pm
r10218 r10254 63 63 64 64 # 12/05/02 Added usage datastructure - John Thompson 65 package EMAILPlug; 65 66 66 67 use strict; 67 68 no strict "refs"; # so we can use a variable as a filehandle for print $out 68 69 69 package EMAILPlug;70 70 71 71 use SplitPlug; 72 # EMAILPlug is a sub-class of SplitPlug.73 @EMAILPlug::ISA = ('SplitPlug');74 75 72 use unicode; # gs conv functions 76 73 use gsprintf 'gsprintf'; # translations … … 79 76 use util; 80 77 78 sub BEGIN { 79 @EMAILPlug::ISA = ('SplitPlug'); 80 } 81 81 82 82 -
trunk/gsdl/perllib/plugins/ExcelPlug.pm
r10218 r10254 29 29 30 30 use ConvertToPlug; 31 use strict; 32 no strict 'refs'; # allow filehandles to be variables and viceversa 31 33 32 34 sub BEGIN { 33 @ ISA = ('ConvertToPlug');35 @ExcelPlug::ISA = ('ConvertToPlug'); 34 36 } 35 37 -
trunk/gsdl/perllib/plugins/FOXPlug.pm
r10218 r10254 40 40 # use gb; 41 41 42 use strict; 43 no strict 'refs'; # allow filehandles to be variables and viceversa 44 42 45 43 46 sub BEGIN { 44 @ISA = ('BasPlug'); 45 } 47 @FOXPlug::ISA = ('BasPlug'); 48 } 49 50 my $arguments = [ 51 ]; 46 52 47 53 my $options = { 'name' => "FOXPlug", … … 149 155 150 156 # open the dbt file if we need to 151 $dbtfullname = $fullname;157 my $dbtfullname = $fullname; 152 158 if ($fullname =~ /f$/) { 153 159 $dbtfullname =~ s/f$/t/; … … 172 178 my $record = []; 173 179 174 foreach $field (@{$dbf{'fieldinfo'}}) {180 foreach my $field (@{$dbf{'fieldinfo'}}) { 175 181 my $fieldvalue = ""; 176 182 … … 267 273 268 274 # add each field 269 foreach $field (@$record) {275 foreach my $field (@$record) { 270 276 if (defined ($field->{'name'}) && defined ($field->{'value'})) { 271 277 $doc_obj->add_utf8_text($section, " <tr>\n"); -
trunk/gsdl/perllib/plugins/FavouritesPlug.pm
r10218 r10254 32 32 use BasPlug; 33 33 use parsargv; 34 use strict; 35 no strict 'refs'; # allow filehandles to be variables and viceversa 34 36 35 37 sub BEGIN { … … 78 80 my $outhandle = $self->{'outhandle'}; 79 81 82 my $section = $doc_obj->get_top_section(); 80 83 print STDERR "<Processing n='$file' p='FavouritesPlug'>\n" if ($gli); 81 84 print $outhandle "FavouritesPlug: processing $file\n" if $self->{'verbosity'} > 1; … … 87 90 my $title = $file; 88 91 $title =~ s/.url$//i; 89 $doc_obj->add_utf8_metadata($ cursection, "Title", $title);92 $doc_obj->add_utf8_metadata($section, "Title", $title); 90 93 91 94 # get the URL from the file 92 95 my ($url) = ($$textref =~ m/^URL=(http.+)/mg); 93 $doc_obj->add_metadata($ cursection, "URL", $url);96 $doc_obj->add_metadata($section, "URL", $url); 94 97 95 98 # Add srclink metadata for an automatic link to the webpage … … 103 106 $$textref =~ s/\]/<\/strong><p>/g; 104 107 $$textref =~ s/^Modified=(.+)$/<strong>Modified<\/strong>$1<p>/g; 105 $doc_obj->add_utf8_text($ cursection, "$$textref");108 $doc_obj->add_utf8_text($section, "$$textref"); 106 109 107 $doc_obj->add_metadata($ cursection, "FileFormat", "Favourite");110 $doc_obj->add_metadata($section, "FileFormat", "Favourite"); 108 111 return 1; 109 112 } -
trunk/gsdl/perllib/plugins/GAPlug.pm
r10218 r10254 32 32 33 33 use XMLPlug; 34 #$%^ 35 use parse2; 34 35 use strict; 36 no strict 'refs'; # allow filehandles to be variables and viceversa 36 37 37 38 sub BEGIN { … … 45 46 return q^(?i)doc\.xml$^; 46 47 } 48 49 my $arguments = [ 50 ]; 47 51 48 52 my $options = { 'name' => "GAPlug", -
trunk/gsdl/perllib/plugins/GISBasPlug.pm
r9963 r10254 28 28 use util; 29 29 use locale; 30 31 use strict; 32 no strict 'refs'; # allow filehandles to be variables and viceversa 30 33 31 34 #field categories in DataBase files … … 35 38 my $DSG = 10; 36 39 #$CC1 = 12; 37 $FULL_NAME = 22;40 my $FULL_NAME = 22; 38 41 39 42 BEGIN { … … 76 79 } 77 80 81 sub print_txt_usage 82 { 83 BasPlug::print_txt_usage(@_); 84 } 78 85 79 86 sub has_mapdata … … 153 160 sub placename_to_anchorname { 154 161 my ($placename) = @_; 155 $p_tag = lc($placename);162 my $p_tag = lc($placename); 156 163 $p_tag =~ s/\s+//g; 157 164 return $p_tag; … … 202 209 #finds 'dangerous' placenames (eg York and New York). Dangerous because program will find "York" within "New York" 203 210 my %danger = (); 204 foreach $x (keys %$uniquePlaces){205 foreach $y (keys %$uniquePlaces){211 foreach my $x (keys %$uniquePlaces){ 212 foreach my $y (keys %$uniquePlaces){ 206 213 if(($y =~ m/ /) && ($y =~ m/$x/) && ($y ne $x)){ 207 214 $y =~ s/($x\s)|(\s$x)//; … … 220 227 foreach my $name (sort (keys %$uniquePlaces)){ 221 228 if(!defined($danger{$name})){ 222 $name_tag = placename_to_anchorname($name);229 my $name_tag = placename_to_anchorname($name); 223 230 print FOUT "$name\t" . $uniquePlaces->{$name}->[$LONG] . "\t" . $uniquePlaces->{$name}->[$LAT] . "\n"; 224 231 if($self->{'place_list'}) {$names = $names . "<a href=\"#" . $name_tag . "1\">" . $name . "</a>" . "\n";} -
trunk/gsdl/perllib/plugins/GMLPlug.pm
r10218 r10254 35 35 use doc; 36 36 37 use strict; 38 no strict 'refs'; # allow filehandles to be variables and viceversa 39 37 40 sub BEGIN { 38 @ ISA = ('BasPlug');41 @GMLPlug::ISA = ('BasPlug'); 39 42 } 40 43 -
trunk/gsdl/perllib/plugins/HBPlug.pm
r10218 r10254 37 37 # expects the marked up files to be cleaner than those used by the 38 38 # Humanity Library collections 39 40 # 12/05/02 Added usage datastructure - John Thompson41 39 42 40 package HBPlug; … … 48 46 use doc; 49 47 48 use strict; 49 no strict 'refs'; # allow filehandles to be variables and viceversa 50 50 51 51 sub BEGIN { 52 @ ISA = ('BasPlug');52 @HBPlug::ISA = ('BasPlug'); 53 53 } 54 54 -
trunk/gsdl/perllib/plugins/ISISPlug.pm
r10218 r10254 31 31 use SplitPlug; 32 32 33 use strict; 34 no strict 'refs'; # allow filehandles to be variables and viceversa 33 35 34 36 # ISISPlug is a sub-class of SplitPlug. 35 37 sub BEGIN { 36 @IS A = ('SplitPlug');38 @ISISPlug::ISA = ('SplitPlug'); 37 39 } 38 40 … … 155 157 my $outhandle = $self->{'outhandle'}; 156 158 159 my $cursection = $doc_obj->get_top_section(); 157 160 my $subfield_separator = $self->{'subfield_separator'}; 158 161 my $entry_separator = $self->{'entry_separator'}; … … 164 167 165 168 # Process each line of the ISIS record, one at a time 166 foreach $line (split(/\n/, $$textref)) {169 foreach my $line (split(/\n/, $$textref)) { 167 170 $line =~ /^tag=(.*) data=(.+)$/; 168 171 my $rawtagname = $1; … … 173 176 # Metadata field names: title case, then remove spaces 174 177 my $tagname = ""; 175 foreach $word (split(/\s+/, $rawtagname)) {178 foreach my $word (split(/\s+/, $rawtagname)) { 176 179 substr($word, 0, 1) =~ tr/a-z/A-Z/; 177 180 $tagname .= $word; … … 183 186 # Handle each piece of metadata ('%' separated) 184 187 my $completetagvalue = ""; 185 foreach $rawtagvalue (split(/%/, $rawtagdata)) {188 foreach my $rawtagvalue (split(/%/, $rawtagdata)) { 186 189 $completetagvalue .= $entry_separator unless ($completetagvalue eq ""); 187 190 … … 255 258 256 259 my $amongstdefinitions = 0; 257 foreach $fdtfileline (<FDT_FILE>) {260 foreach my $fdtfileline (<FDT_FILE>) { 258 261 $fdtfileline =~ s/(\s*)$//; # Remove any nasty spaces at the end of the lines 259 262 -
trunk/gsdl/perllib/plugins/ImagePlug.pm
r10218 r10254 28 28 use BasPlug; 29 29 30 use strict; 31 no strict 'refs'; # allow filehandles to be variables and viceversa 32 30 33 sub BEGIN { 31 @I SA = ('BasPlug');34 @ImagePlug::ISA = ('BasPlug'); 32 35 } 33 36 -
trunk/gsdl/perllib/plugins/IndexPlug.pm
r10218 r10254 60 60 use cfgread; 61 61 62 use strict; 63 no strict 'refs'; # allow filehandles to be variables and viceversa 64 62 65 sub BEGIN { 63 @I SA = ('BasPlug');66 @IndexPlug::ISA = ('BasPlug'); 64 67 } 68 69 my $arguments = [ 70 ]; 65 71 66 72 my $options = { 'name' => "IndexPlug", -
trunk/gsdl/perllib/plugins/LaTeXPlug.pm
r10218 r10254 29 29 30 30 # System complains about $arguments if the strict is set 31 #use strict;32 #no strict 'refs'; # so we can print to a handle named by a variable31 use strict; 32 no strict 'refs'; # so we can print to a handle named by a variable 33 33 34 34 # greenstone packages … … 38 38 use util; 39 39 40 my $arguments = [ 41 ]; 40 42 my $options={ 'name' => 'LaTeXPlug', 41 43 'desc' => '{LaTeXPlug.desc}', -
trunk/gsdl/perllib/plugins/MACROPlug.pm
r10218 r10254 29 29 use parsargv; 30 30 31 use strict; 32 no strict 'refs'; # allow filehandles to be variables and viceversa 31 33 32 34 sub BEGIN { 33 @ ISA = ('BasPlug');35 @MACROPlug::ISA = ('BasPlug'); 34 36 } 35 37 … … 175 177 my $image_macro = "false"; 176 178 my $norm_macro = "false"; 177 179 my $currpackage = ""; 180 178 181 #print STDERR "FILE@@@@@ $file\n"; 179 182 180 183 #foreach my $ta (@textarray) { 181 184 182 for ( $k = 0; $k < scalar(@textarray); $k++) {183 184 $ta = $textarray[$k];185 for (my $k = 0; $k < scalar(@textarray); $k++) { 186 187 my $ta = $textarray[$k]; 185 188 186 189 #print STDERR "$ta\n" if ($file =~ m/port/); … … 370 373 $results = $self->{'textcat'}->classify(\$text); 371 374 372 foreach $r (@$results) {375 foreach my $r (@$results) { 373 376 print $outhandle "Results: $r\n"; 374 377 … … 385 388 while (<LANGFILE>) { 386 389 387 $line = $_;390 my $line = $_; 388 391 chomp($line); 389 392 390 $fn = $filename;393 my $fn = $filename; 391 394 $fn =~ s/.*\/(.*)\..*/$1/; 392 395 … … 398 401 print $outhandle "language code is $line\n"; 399 402 400 foreach $r (@$results) {403 foreach my $r (@$results) { 401 404 print $outhandle "MY1 $r\n"; 402 405 403 $roar = $& if($r =~ m/../);406 my $roar = $& if($r =~ m/../); 404 407 405 408 if ($roar eq $line) { … … 486 489 487 490 while ($try_len>=4) { 488 $try_fn = substr($fn,0,$try_len);491 my $try_fn = substr($fn,0,$try_len); 489 492 490 493 if (defined $lang_table->{$try_fn}) { … … 509 512 $fn =~ s/\d+$//; # remove any digits from end of filename 510 513 511 my $langu ge;514 my $language; 512 515 my $encoding = "utf8"; 513 516 -
trunk/gsdl/perllib/plugins/MARCPlug.pm
r10218 r10254 33 33 use parsargv; 34 34 35 use strict; 36 no strict 'refs'; # allow filehandles to be variables and viceversa 37 35 38 sub BEGIN { 36 @ ISA = ('SplitPlug');39 @MARCPlug::ISA = ('SplitPlug'); 37 40 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan"); 38 41 } … … 261 264 my @words = split(/ /, $text); 262 265 263 foreach $word (@words) {266 foreach my $word (@words) { 264 267 # If printing this word would exceed the column end, start a new line 265 268 if (($linelength + length($word)) >= $columnwidth) { … … 301 304 foreach $metavalue ( @metavalues ) 302 305 { 303 $metavalue_str = $self->to_utf8($encoding,$metavalue->as_string());304 $doc_obj->add_utf8_metadata ($ thissection, $metaname, $metavalue_str);306 my $metavalue_str = $self->to_utf8($encoding,$metavalue->as_string()); 307 $doc_obj->add_utf8_metadata ($section, $metaname, $metavalue_str); 305 308 } 306 309 } -
trunk/gsdl/perllib/plugins/METSPlug.pm
r10218 r10254 35 35 use ghtml; 36 36 37 use strict; 38 no strict 'refs'; # allow filehandles to be variables and viceversa 39 37 40 use XMLPlug; 38 41 use XML::XPath; … … 43 46 } 44 47 48 my $arguments = [ 49 ]; 45 50 my $options = { 'name' => "METSPlug", 46 51 'desc' => "{METSPlug.desc}", -
trunk/gsdl/perllib/plugins/MP3Plug.pm
r10218 r10254 31 31 use parsargv; 32 32 33 use strict; 34 no strict 'refs'; # allow filehandles to be variables and viceversa 35 33 36 use MP3::Info; 34 37 … … 36 39 37 40 sub BEGIN { 38 @ ISA = ('UnknownPlug');41 @MP3Plug::ISA = ('UnknownPlug'); 39 42 } 40 43 … … 179 182 if ($mp3_metavalue !~ m/^\s*$/s) { 180 183 my $kt_len = length($kt); 181 $kt_initial_cap = uc(substr($kt,0,1)).lc(substr($kt,1,$kt_len-1));184 my $kt_initial_cap = uc(substr($kt,0,1)).lc(substr($kt,1,$kt_len-1)); 182 185 my $mp3_metaname = "mp3:".$kt_initial_cap; 183 186 -
trunk/gsdl/perllib/plugins/MetadataPass.pm
r9959 r10254 26 26 package MetadataPass; 27 27 28 use strict; 29 no strict 'refs'; # allow filehandles to be variables and viceversa 28 30 29 31 use BasPlug; # uses BasPlug, but is not inherited -
trunk/gsdl/perllib/plugins/NULPlug.pm
r10218 r10254 38 38 39 39 use BasPlug; 40 use parsargv;41 40 41 use strict; 42 no strict 'refs'; # allow filehandles to be variables and viceversa 42 43 43 44 sub BEGIN { … … 45 46 } 46 47 47 #my $arguments = 48 # [ 49 # ]; 48 my $arguments = [ 49 ]; 50 50 51 51 my $options = { 'name' => "NULPlug", -
trunk/gsdl/perllib/plugins/OAIPlug.pm
r10218 r10254 30 30 use unicode; 31 31 use util; 32 use parsargv; 32 33 use strict; 34 no strict 'refs'; # allow filehandles to be variables and viceversa 33 35 34 36 use XMLPlug; … … 53 55 'args' => $arguments }; 54 56 57 55 58 sub new { 56 59 my ($class) = shift (@_); … … 73 76 74 77 sub xml_start_document { 78 my $self = shift (@_); 75 79 $self->{'in_metadata_node'} = 0; 76 80 $self->{'rawxml'} = ""; … … 170 174 171 175 my $url_array = $metadata->{'URL'}; 172 my $num_urls = (defined $url_arr y) ? scalar(@$url_array) : 0;176 my $num_urls = (defined $url_array) ? scalar(@$url_array) : 0; 173 177 174 178 my $srcdoc_exists = 0; … … 331 335 if ($$textref =~ m/<metadata\s*>(.*?)<\/metadata\s*>/s) 332 336 { 333 $metadata_text = $1;337 my $metadata_text = $1; 334 338 $metadata_text =~ s/^.*?<(oai_dc:)?dc.*?>(.*?)<\/(oai_dc:)?dc>.*?/$2/s; 335 339 -
trunk/gsdl/perllib/plugins/OggVorbisPlug.pm
r10218 r10254 33 33 use Ogg::Vorbis::Header::PurePerl; 34 34 35 use strict; 36 no strict 'refs'; # allow filehandles to be variables and viceversa 35 37 36 38 sub BEGIN { … … 103 105 my $doc_obj = new doc ($filename, "indexed_doc"); 104 106 $doc_obj->set_OIDtype ("incremental"); # this is done to avoid hashing content of file 105 107 my $section = $doc_obj->get_top_section(); 108 106 109 # replace spaces in filename with %20 in url for metadata entry 107 110 my $url = $file; … … 153 156 154 157 # include any metadata passed in from previous plugins 155 my $section = $doc_obj->get_top_section();156 158 $self->extra_metadata ($doc_obj, $section, $metadata); 157 159 -
trunk/gsdl/perllib/plugins/PPTPlug.pm
r10218 r10254 29 29 30 30 use ConvertToPlug; 31 use strict; 32 no strict 'refs'; # allow filehandles to be variables and viceversa 31 33 32 34 sub BEGIN { 33 @ ISA = ('ConvertToPlug');35 @PPTPlug::ISA = ('ConvertToPlug'); 34 36 } 35 37 -
trunk/gsdl/perllib/plugins/PSPlug.pm
r10218 r10254 31 31 use sorttools; 32 32 33 use strict; 34 no strict 'refs'; # allow filehandles to be variables and viceversa 35 33 36 sub BEGIN { 34 @ ISA = ('ConvertToPlug');37 @PSPlug::ISA = ('ConvertToPlug'); 35 38 } 36 39 -
trunk/gsdl/perllib/plugins/PagedImgPlug.pm
r10218 r10254 135 135 136 136 use XMLPlug; 137 use strict; 138 no strict 'refs'; # allow filehandles to be variables and viceversa 137 139 138 140 sub BEGIN { … … 282 284 my $filehead = &util::get_tmp_filename(); 283 285 $filename = $filehead . ".$converttotype"; 284 $n = 1;286 my $n = 1; 285 287 while (-e $filename) { 286 288 $filename = "$filehead$n\.$converttotype"; … … 527 529 528 530 sub read { 529 $self = shift (@_);531 my $self = shift (@_); 530 532 my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_; 531 533 my $outhandle = $self->{'outhandle'}; … … 643 645 $self->extra_metadata ($doc_obj, $section, $metadata); 644 646 645 # do plugin specific processing of doc_obj 646 unless (defined ($self->process(\$text, $pluginfo, $base_dir, $file, $metadata, $doc_obj))) { 647 print STDERR "<ProcessingError n='$file'>\n" if ($gli); 648 return -1; 649 } 647 # do plugin specific processing of doc_obj - don't need this unless 648 # something inherits from PagedImgPlug 649 #unless (defined ($self->process(\$text, $pluginfo, $base_dir, $file, $metadata, $doc_obj))) { 650 # print STDERR "<ProcessingError n='$file'>\n" if ($gli); 651 # return -1; 652 # } 650 653 651 654 # do any automatic metadata extraction … … 806 809 if ($line =~ /^<([^>]*)>(.*?)\s*$/) { 807 810 $doc_obj->set_utf8_metadata_element ($topsection, $1, $2); 808 $meta->{$1} = $2;811 #$meta->{$1} = $2; 809 812 } else { 810 813 $num++; -
trunk/gsdl/perllib/plugins/ProCitePlug.pm
r10218 r10254 31 31 use SplitPlug; 32 32 33 use strict; 34 no strict 'refs'; # allow filehandles to be variables and viceversa 33 35 34 36 # ProCitePlug is a sub-class of SplitPlug 35 37 sub BEGIN { 36 @ ISA = ('SplitPlug');38 @ProCitePlug::ISA = ('SplitPlug'); 37 39 } 38 40 … … 158 160 my $outhandle = $self->{'outhandle'}; 159 161 my $filename = &util::filename_cat($base_dir, $file); 160 162 my $cursection = $doc_obj->get_top_section(); 161 163 # Report that we're processing the file 162 164 print STDERR "<Processing n='$file' p='ProCitePlug'>\n" if ($gli); … … 216 218 217 219 # Multiple metadata values are separated with "//" 218 foreach $field_value (split(/\/\//, $field_value_raw)) {220 foreach my $field_value (split(/\/\//, $field_value_raw)) { 219 221 my $meta_name = "pc.Field" . ($fieldnum + 1) . "Value"; 220 222 $doc_obj->add_utf8_metadata($cursection, $meta_name, $field_value); -
trunk/gsdl/perllib/plugins/RTFPlug.pm
r10218 r10254 30 30 31 31 use ConvertToPlug; 32 use strict; 33 no strict 'refs'; # allow filehandles to be variables and viceversa 32 34 33 35 sub BEGIN { 34 @ ISA = ('ConvertToPlug');36 @RTFPlug::ISA = ('ConvertToPlug'); 35 37 } 36 38 -
trunk/gsdl/perllib/plugins/RecPlug.pm
r10218 r10254 99 99 100 100 use File::Basename; 101 101 use strict; 102 no strict 'refs'; 102 103 103 104 BEGIN { -
trunk/gsdl/perllib/plugins/ReferPlug.pm
r10218 r10254 66 66 67 67 use SplitPlug; 68 use strict; 69 no strict 'refs'; # allow filehandles to be variables and viceversa 68 70 69 71 # ReferPlug is a sub-class of BasPlug. 70 72 sub BEGIN { 71 @ ISA = ('SplitPlug');73 @ReferPlug::ISA = ('SplitPlug'); 72 74 } 73 75 … … 125 127 return undef unless ($$textref =~ /^\s*%/); 126 128 129 my $cursection = $doc_obj->get_top_section(); 127 130 # Report that we're processing the file 128 131 print STDERR "<Processing n='$file' p='ReferPlug'>\n" if ($gli); … … 165 168 $line =~ s/\s+/ /g; 166 169 $text .= "$line\n"; 167 $ReferFormat .= "$line\n";170 # $ReferFormat .= "$line\n"; # what is this??? 168 171 169 172 next unless ($line =~ /^%[A-Z\*]/); -
trunk/gsdl/perllib/plugins/RogPlug.pm
r10218 r10254 32 32 use doc; 33 33 34 use strict; 35 no strict 'refs'; # allow filehandles to be variables and viceversa 36 34 37 sub BEGIN { 35 @ ISA = ('BasPlug');38 @RogPlug::ISA = ('BasPlug'); 36 39 } 37 40 … … 196 199 $doc_obj->add_metadata($cursection, "FileSize", (-s $file)); 197 200 198 foreach $md ( @{$song->{'metadata'}} )201 foreach my $md ( @{$song->{'metadata'}} ) 199 202 { 200 203 $doc_obj->add_metadata($cursection, $md->[0], $md->[1]); -
trunk/gsdl/perllib/plugins/SRCPlug.pm
r10218 r10254 42 42 use parsargv; 43 43 44 use strict; 45 no strict 'refs'; # allow filehandles to be variables and viceversa 46 44 47 sub BEGIN { 45 @ ISA = ('BasPlug');48 @SRCPlug::ISA = ('BasPlug'); 46 49 } 47 50 … … 174 177 ($$textref =~ m/^\s*\#\s*include\s*(?:\"|<)(.*?)(?:\"|>)/mg); 175 178 176 my $incs_done_ref=$doc_obj->get_metadata($ section, "includes");179 my $incs_done_ref=$doc_obj->get_metadata($topsection, "includes"); 177 180 my @incs_done; 178 181 if (defined($incs_done_ref)) { … … 230 233 my $classname=$1; 231 234 $classname =~ s/.*class\W(\w+).*/$1/; 232 my $classes=$doc_obj->get_metadata($ section, "class");235 my $classes=$doc_obj->get_metadata($topsection, "class"); 233 236 foreach my $elem (@$classes) { 234 237 if ("$elem" eq "$classname") {goto class_done;} -
trunk/gsdl/perllib/plugins/SplitPlug.pm
r10218 r10254 44 44 use util; 45 45 46 use strict; 47 no strict 'refs'; # allow filehandles to be variables and viceversa 48 46 49 # SplitPlug is a sub-class of BasPlug. 47 50 sub BEGIN { 48 @SplitPlug::ISA = ('BasPlug');51 @SplitPlug::ISA = ('BasPlug'); 49 52 } 50 53 … … 120 123 $extrametadata, $processor, 121 124 $maxdocs, $gli); 122 $split_matched = undef;125 my $split_matched = undef; 123 126 124 127 if ($matched) { -
trunk/gsdl/perllib/plugins/TEXTPlug.pm
r10218 r10254 32 32 33 33 use BasPlug; 34 use parsargv;35 34 35 use strict; 36 no strict 'refs'; # allow filehandles to be variables and viceversa 36 37 37 38 sub BEGIN { 38 @ ISA = ('BasPlug');39 @TEXTPlug::ISA = ('BasPlug'); 39 40 } 40 41 -
trunk/gsdl/perllib/plugins/UnknownPlug.pm
r10218 r10254 57 57 58 58 use BasPlug; 59 use parsargv; 60 #$%^ 61 use parse2; 62 63 59 60 use strict; 61 no strict 'refs'; # allow filehandles to be variables and viceversa 64 62 65 63 sub BEGIN { -
trunk/gsdl/perllib/plugins/W3ImgPlug.pm
r10218 r10254 117 117 use util; 118 118 use parsargv; 119 use strict 'subs'; 119 use strict; # 'subs'; 120 no strict 'refs'; # allow filehandles to be variables and viceversa 120 121 121 122 sub BEGIN { 122 @ ISA = qw( HTMLPlug );123 @W3ImgPlug::ISA = qw( HTMLPlug ); 123 124 } 124 125 … … 423 424 $doc_obj = new doc ("", "indexed_doc"); 424 425 $section = $doc_obj->get_top_section(); 425 $prevpos = ( $i == 0 ? 0 : $imgs->{$fplist[$i - 1]}{'pos'});426 $nextpos = ( $i >= ($nimgs -1) ? -1 : $imgs->{$fplist[$i + 1]}{'pos'} );426 my $prevpos = ( $i == 0 ? 0 : $imgs->{$fplist[$i - 1]}{'pos'}); 427 my $nextpos = ( $i >= ($nimgs -1) ? -1 : $imgs->{$fplist[$i + 1]}{'pos'} ); 427 428 428 429 $self->extract_image_info($imgtag, $filepath, $textref, $doc_obj, $section, $tndir, $prevpos, $nextpos); … … 459 460 $orig_fp =~ s/\\/\//g; 460 461 $filepath = "$self->{'htpath'}/$filepath"; 461 ($onlyfn) = $filename =~ /([^\\\/]*)$/;462 my ($onlyfn) = $filename =~ /([^\\\/]*)$/; 462 463 ($fn, $ext) = $onlyfn =~ /(.*)\.(.*)/; 463 464 $fn = lc $fn; $ext = lc $ext; … … 601 602 if ( $self->{'aggressiveness'} == 5 && ! $self->{'smallpage'} ) { 602 603 @pagemeta = $self->get_page_metadata($textref); 603 foreach $value ( @pagemeta ) {604 foreach my $value ( @pagemeta ) { 604 605 $context .= "$value."; # make each into psuedo-sentence 605 606 } … … 611 612 612 613 # extract general references 613 foreach $rw ( @refwords ) {614 foreach my $rw ( @refwords ) { 614 615 while ( $context =~ /[\.\?\!\,](.*?$rw\W.*?[\.\?\!\,])/ig ) { 615 $sentence = $1;616 my $sentence = $1; 616 617 $sentence =~ s/\s+/ /g; 617 618 $sentences{$sentence}+=2; … … 621 622 my ($fignum) = $context =~ /[\.\?\!].*?(?:figure|table)s?[\-\_\ \.](\d+\w*)\W.*?[\.\?\!]/ig; 622 623 if ( $fignum ) { 623 foreach $rw ( @refwords ) {624 foreach my $rw ( @refwords ) { 624 625 while ( $context =~ /[\.\?\!](.*?(figure|table)[\-\_\ \.]$fignum\W.*?[\.\?\!])/ig ) { 625 $sentence = $1;626 my $sentence = $1; 626 627 $sentence =~ s/\s+/ /g; 627 628 $sentences{$sentence}+=4; … … 632 633 # sentences with occurances of important words 633 634 @relwords = $reltext =~ /([a-zA-Z]{4,})/g; # take out small words 634 foreach $word ( @relwords ) {635 foreach my $word ( @relwords ) { 635 636 if ( $self->{'stopwords'}{$word} ) { next } # skip stop words 636 637 while ( $context =~ /([^\.\?\!]*?$word\W.*?[\.\?\!])/ig ) { 637 $sentence = $1;638 my $sentence = $1; 638 639 $sentence =~ s/\s+/ /g; 639 640 $sentences{$sentence}++; 640 641 } 641 642 } 642 foreach $sentence ( keys %sentences ) {643 foreach my $sentence ( keys %sentences ) { 643 644 if ($sentences{$sentence} < $self->{'textrefs_threshold'}) { 644 645 delete $sentences{$sentence}; … … 656 657 sub extract_caption_text { 657 658 my ($self, $tag, $textref, $prevpos, $pos, $nextpos) = (@_); 658 my (@neartext, $len, $hdelim, $ goodlen,659 my (@neartext, $len, $hdelim, $mintext, $goodlen, 659 660 $startpos, $context, $context_size); 660 661 … … 1003 1004 } 1004 1005 $num = 0; 1005 foreach $i ( keys %{$imgs} ) {1006 foreach my $i ( keys %{$imgs} ) { 1006 1007 if ( $imgs->{$i}{'pos'} ) { 1007 1008 $num++; -
trunk/gsdl/perllib/plugins/WordPlug.pm
r10218 r10254 29 29 30 30 use ConvertToPlug; 31 use strict; 32 no strict 'refs'; # allow filehandles to be variables and viceversa 31 33 32 34 sub BEGIN { 33 @ ISA = ('ConvertToPlug');35 @WordPlug::ISA = ('ConvertToPlug'); 34 36 } 35 37 -
trunk/gsdl/perllib/plugins/XMLPlug.pm
r10218 r10254 28 28 use BasPlug; 29 29 use doc; 30 #$%^ 31 use parse2; 30 use strict; 31 no strict 'refs'; # allow filehandles to be variables and viceversa 32 32 33 33 sub BEGIN { … … 106 106 if (open(XMLIN,"<$filename")) { 107 107 108 $untransformed_xml = "";108 my $untransformed_xml = ""; 109 109 while (defined (my $line = <XMLIN>)) { 110 110 … … 138 138 } 139 139 else { 140 print $outhandle "Error: Unable to run command $xsl _cmd\n";140 print $outhandle "Error: Unable to run command $xslt_cmd\n"; 141 141 print $outhandle " $!\n"; 142 142 } -
trunk/gsdl/perllib/plugins/ZIPPlug.pm
r10218 r10254 50 50 use util; 51 51 use Cwd; 52 #$%^ 53 use parse2;54 52 53 use strict; 54 no strict 'refs'; # allow filehandles to be variables and viceversa 55 55 56 56 BEGIN { 57 @ ISA = ('BasPlug');57 @ZIPPlug::ISA = ('BasPlug'); 58 58 } 59 59
Note:
See TracChangeset
for help on using the changeset viewer.