Changeset 14103 for trunk/gsdl/perllib/plugins/XMLPlug.pm
- Timestamp:
- 2007-05-28T13:35:30+12:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugins/XMLPlug.pm
r13226 r14103 56 56 'args' => $arguments }; 57 57 58 59 our ($self);60 58 sub new { 61 59 my ($class) = shift (@_); … … 67 65 68 66 # $self is global for use within subroutines called by XML::Parser 69 $self = new BasPlug($pluginlist, $inputargs, $hashArgOptLists);67 my $self = new BasPlug($pluginlist, $inputargs, $hashArgOptLists); 70 68 71 69 if ($self->{'info_only'}) { … … 75 73 76 74 my $parser = new XML::Parser('Style' => 'Stream', 75 'Pkg' => 'XMLPlug', 76 'PluginObj' => $self, 77 77 'Handlers' => {'Char' => \&Char, 78 78 'XMLDecl' => \&XMLDecl, … … 80 80 'Doctype' => \&Doctype, 81 81 'Default' => \&Default, 82 }); 82 }); 83 83 84 84 $self->{'parser'} = $parser; … … 160 160 161 161 sub check_doctype { 162 $self = shift (@_);162 my $self = shift (@_); 163 163 164 164 my ($filename) = @_; 165 165 166 166 if (open(XMLIN,"<$filename")) { 167 167 my $doctype = $self->get_doctype(); … … 190 190 # because we are not just using process_exp to determine whether to process or not, we need to implement this too, so that a file can be passed down if we are not actually processing it 191 191 sub metadata_read { 192 $self = shift (@_);192 my $self = shift (@_); 193 193 194 194 my ($pluginfo, $base_dir, $file, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_; … … 208 208 209 209 sub read { 210 # $self must be global to work with XML callback routines. 211 $self = shift (@_); 210 my $self = shift (@_); 212 211 213 212 my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_; … … 275 274 # plugin that inherits from this. it seems that you can't call the parse 276 275 # methods directly. WHY??? 276 # 277 # [Stefan 27/5/07] These two methods may not be necessary any more as I've 278 # fixed XMLPlug so $self is no longer required to be a global variable 279 # (that was why inheritance wasn't working quite right with XMLPlug I 280 # think). I don't really know what other plugins rely on these methods 281 # though so have left them here for now. 277 282 sub parse_file { 278 $self = shift (@_);283 my $self = shift (@_); 279 284 my ($filename) = @_; 280 285 $self->{'parser'}->parsefile($filename); … … 282 287 283 288 sub parse_string { 284 $self = shift (@_);289 my $self = shift (@_); 285 290 my ($xml_string) = @_; 286 291 $self->{'parser'}->parse($xml_string); … … 293 298 } 294 299 295 sub StartDocument {$ self->xml_start_document(@_);}296 sub XMLDecl {$ self->xml_xmldecl(@_);}297 sub Entity {$ self->xml_entity(@_);}298 sub Doctype {$ self->xml_doctype(@_);}299 sub StartTag {$ self->xml_start_tag(@_);}300 sub EndTag {$ self->xml_end_tag(@_);}301 sub Text {$ self->xml_text(@_);}302 sub PI {$ self->xml_pi(@_);}303 sub EndDocument {$ self->xml_end_document(@_);}304 sub Default {$ self->xml_default(@_);}300 sub StartDocument {$_[0]->{'PluginObj'}->xml_start_document(@_);} 301 sub XMLDecl {$_[0]->{'PluginObj'}->xml_xmldecl(@_);} 302 sub Entity {$_[0]->{'PluginObj'}->xml_entity(@_);} 303 sub Doctype {$_[0]->{'PluginObj'}->xml_doctype(@_);} 304 sub StartTag {$_[0]->{'PluginObj'}->xml_start_tag(@_);} 305 sub EndTag {$_[0]->{'PluginObj'}->xml_end_tag(@_);} 306 sub Text {$_[0]->{'PluginObj'}->xml_text(@_);} 307 sub PI {$_[0]->{'PluginObj'}->xml_pi(@_);} 308 sub EndDocument {$_[0]->{'PluginObj'}->xml_end_document(@_);} 309 sub Default {$_[0]->{'PluginObj'}->xml_default(@_);} 305 310 306 311 # This Char function overrides the one in XML::Parser::Stream to overcome a
Note:
See TracChangeset
for help on using the changeset viewer.