Changeset 15872 for gsdl/trunk/perllib/plugins/TextPlugin.pm
- Timestamp:
- 2008-06-05T09:29:32+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/plugins/TextPlugin.pm
r15865 r15872 1 1 ########################################################################### 2 2 # 3 # T EXTPlug.pm -- simple text plugin3 # TextPlugin.pm -- simple text plugin 4 4 # A component of the Greenstone digital library software 5 5 # from the New Zealand Digital Library Project at the … … 29 29 # 12/05/02 Added usage datastructure - John Thompson 30 30 31 package T EXTPlug;32 33 use BasPlug;31 package TextPlugin; 32 33 use ReadTextFile; 34 34 35 35 use strict; 36 36 no strict 'refs'; # allow filehandles to be variables and viceversa 37 no strict 'subs'; 37 38 38 39 sub BEGIN { 39 @T EXTPlug::ISA = ('BasPlug');40 @TextPlugin::ISA = ('ReadTextFile'); 40 41 } 41 42 42 43 my $arguments = 43 44 [ { 'name' => "process_exp", 44 'desc' => "{Bas Plug.process_exp}",45 'desc' => "{BasePlugin.process_exp}", 45 46 'type' => "regexp", 46 47 'deft' => &get_default_process_exp(), 47 48 'reqd' => "no" } , 48 49 { 'name' => "title_sub", 49 'desc' => "{T EXTPlug.title_sub}",50 'desc' => "{TextPlugin.title_sub}", 50 51 'type' => "regexp", 51 52 'deft' => "", 52 53 'reqd' => "no" } ]; 53 54 54 my $options = { 'name' => "T EXTPlug",55 'desc' => "{T EXTPlug.desc}",55 my $options = { 'name' => "TextPlugin", 56 'desc' => "{TextPlugin.desc}", 56 57 'abstract' => "no", 57 58 'inherits' => "yes", … … 65 66 push(@$pluginlist, $class); 66 67 67 if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}68 if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};69 70 my $self = new BasPlug($pluginlist, $inputargs, $hashArgOptLists);68 push(@{$hashArgOptLists->{"ArgList"}},@{$arguments}); 69 push(@{$hashArgOptLists->{"OptList"}},$options); 70 71 my $self = new ReadTextFile($pluginlist, $inputargs, $hashArgOptLists); 71 72 72 73 return bless $self, $class; … … 85 86 my $outhandle = $self->{'outhandle'}; 86 87 87 print STDERR "<Processing n='$file' p='T EXTPlug'>\n" if ($gli);88 print $outhandle "T EXTPlug: processing $file\n"88 print STDERR "<Processing n='$file' p='TextPlugin'>\n" if ($gli); 89 print $outhandle "TextPlugin xx: processing $file\n" 89 90 if $self->{'verbosity'} > 1; 90 91 … … 109 110 } 110 111 # Add FileFormat metadata 111 $doc_obj->add_metadata($cursection, "FileFormat", "T EXT");112 $doc_obj->add_metadata($cursection, "FileFormat", "Text"); 112 113 113 114 # insert preformat tags and add text to document object … … 136 137 # replace_srcdoc_with_html.pl requires all subroutines that support src_replaceable 137 138 # to contain a method called tmp_area_convert_file - this is indeed the case with all 138 # Perl modules that are subclasses of ConvertToPlug.pm, but as we want T EXTPlugto also139 # be srcreplaceable and because T EXTPlugdoes not inherit from ConvertToPlug.pm, we have139 # Perl modules that are subclasses of ConvertToPlug.pm, but as we want TextPlugin to also 140 # be srcreplaceable and because TextPlugin does not inherit from ConvertToPlug.pm, we have 140 141 # a similar subroutine with the same name here. 141 142 sub tmp_area_convert_file { … … 192 193 # Recreate the original file for writing the updated contents 193 194 unless(open(TEXT, "<$tmp_filename")) { # open it as a new file for writing 194 print STDERR "T EXTPlug.pm: Unable to open and read from $tmp_filename for converting to html...ERROR: $!\n";195 print STDERR "TextPlugin.pm: Unable to open and read from $tmp_filename for converting to html...ERROR: $!\n"; 195 196 return ""; # no file name 196 197 } … … 212 213 # try creating this new file writing and try opening it for writing, else exit with error value 213 214 unless(open(HTML, ">$output_filename")) { # open the new html file for writing 214 print STDERR "T EXTPlug.pm: Unable to create $output_filename for writing $tailname$suffix txt converted to html...ERROR: $!\n";215 print STDERR "TextPlugin.pm: Unable to create $output_filename for writing $tailname$suffix txt converted to html...ERROR: $!\n"; 215 216 return ""; # no filename 216 217 }
Note:
See TracChangeset
for help on using the changeset viewer.