Bio::OntologyIO::Handlers::BaseSAXHandler
This module is an abstract module, serving as the base of any SAX Handler implementation. It tries to offer the framework that SAX handlers generally need, such as tag_stack, char_store, etc.
In the implementation handler, you can take advantage of this based module by the following suggestions.
1) In start_element,
sub start_element { my $self=shift; my $tag=$_[0]->{Name}; my %args=%{$_[0]->{Attributes}}; # Your code here. # Before you enclose this method, write these 2 line. $self->_visited_count_inc($tag); $self->_push_tag($tag); }
2) In end_element,
sub end_element { my $self=shift; my $tag=shift->{Name}; # Your code here. # Before you enclode this method, wirte these 2 lines. $self->_visited_count_dec($tag); $self->_pop_tag; }
3) In characters, or any other methods where you may used the tag stack or count
sub characters { my $self=shift; my $text=shift->{Data}; $self->_chars_hash->{$self->_top_tag} .= $text; } $count = $self->_visited_count('myTag'); $tag = $self->_top_tag;
Juguang Xiao, juguang@tll.org.sg
The rest of the documentation details each of the object methods. Interal methods are usually preceded with a _
Title : _tag_stack Usage : @tags = $self->_tag_stack; Function: Get an array of tags that have been accessed but not enclosed. Return : Args :
Title : _top_tag Usage : $top = $self->_top_tag; Function: get the top tag in the tag stack. Return : a tag name Args : [none]
Title : _chars_hash Usage : $hash= $self->_chars_hash; Function: return the character cache for the specific tag Return : a hash reference, which is intent for character storage for tags Args : [none]
Title : _vistied_count_inc Usage : $self->vistied_count_inc($tag); # the counter for the tag increase Function: the counter for the tag increase Return : the current count after this increment Args : the tag name [scalar]
Title : _visited_count_dec Usage : $self->_visited_count_dec($tag); Function: the counter for the tag decreases by one Return : the current count for the specific tag after the decrement Args : the tag name [scalar]
Title : _visited_count Usage : $count = $self->_visited_count Function: return the counter for the tag Return : the current counter for the specific tag Args : the tag name [scalar]
To install Bio::Seq, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bio::Seq
CPAN shell
perl -MCPAN -e shell install Bio::Seq
For more information on module installation, please visit the detailed CPAN module installation guide.