| Bio-Phylo documentation | Contained in the Bio-Phylo distribution. |
Bio::Phylo::Identifiable - Objects with unique identifiers
# Actually, you would almost never use this module directly. This is # the base class for other modules. use Bio::Phylo::Identifiable; my $obj = Bio::Phylo::Identifiable->new; print $obj->get_id;
This is the base class for objects in the Bio::Phylo package that need unique identifiers.
Type : Constructor Title : new Usage : my $phylo = Bio::Phylo::Identifiable->new; Function: Instantiates Bio::Phylo::Identifiable object Returns : a Bio::Phylo::Identifiable object Args : NONE
Gets invocant's UID.
Type : Accessor Title : get_id Usage : my $id = $obj->get_id; Function: Returns the object's unique ID Returns : INT Args : None
Also see the manual: Bio::Phylo::Manual and http://rutgervos.blogspot.com
If you use Bio::Phylo in published research, please cite it:
Rutger A Vos, Jason Caravas, Klaas Hartmann, Mark A Jensen and Chase Miller, 2011. Bio::Phylo - phyloinformatic analysis using Perl. BMC Bioinformatics 12:63. http://dx.doi.org/10.1186/1471-2105-12-63
$Id: Identifiable.pm 1593 2011-02-27 15:26:04Z rvos $
| Bio-Phylo documentation | Contained in the Bio-Phylo distribution. |
package Bio::Phylo::Identifiable; use Bio::Phylo::Util::IDPool; use Bio::Phylo::Util::Exceptions 'throw';
sub new { my $class = shift; # happens only and exactly once because this # root class is visited from every constructor my $self = Bio::Phylo::Util::IDPool->_initialize(); # bless in child class, not __PACKAGE__ bless $self, $class; return $self; }
sub get_id { my ($self) = @_; if ( UNIVERSAL::isa( $self, 'SCALAR' ) ) { return $$self; } else { throw 'API' => "Not a SCALAR reference"; } }
1;