Bio::Phylo::Util::CONSTANT(3)

NAME
Bio::Phylo::Util::CONSTANT - Global constants and utility functions

DESCRIPTION
This package defines globals used in the Bio::Phylo libraries. The constants are called internally by the other packages, they have no direct usage. In addition, several useful subroutines are optionally exported, which are described below.

SUBROUTINES
The following subroutines are utility functions that can be imported using:

 use Bio::Phylo::Util::CONSTANT ':functions';

The subroutines use prototypes for more concise syntax, e.g.:

 looks_like_number $num;
 looks_like_object $obj, $const;
 looks_like_hash @_;
 looks_like_class $class;

These subroutines are used for argument processing inside method calls.

looks_like_instance()
    Tests if argument 1 looks like an instance of argument 2

     Type    : Utility function
     Title   : looks_like_instance
     Usage   : do 'something' if looks_like_instance $var, $class;
     Function: Tests whether $var looks like an instance of $class.
     Returns : TRUE or undef
     Args    : $var = a variable to test, a $class to test against.
               $class can also be anything returned by ref($var), e.g.
               'HASH', 'CODE', etc.

looks_like_implementor()
    Tests if argument 1 implements argument 2

     Type    : Utility function
     Title   : looks_like_implementor
     Usage   : do 'something' if looks_like_implementor $var, $method;
     Function: Tests whether $var implements $method
     Returns : return value of UNIVERSAL::can or undef
     Args    : $var = a variable to test, a $method to test against.

looks_like_number()
    Tests if argument looks like a number.

     Type    : Utility function
     Title   : looks_like_number
     Usage   : do 'something' if looks_like_number $var;
     Function: Tests whether $var looks like a number.
     Returns : TRUE or undef
     Args    : $var = a variable to test

looks_like_object()
    Tests if argument looks like an object of specified type constant.

     Type    : Utility function
     Title   : looks_like_object
     Usage   : do 'something' if looks_like_object $obj, $const;
     Function: Tests whether $obj looks like an object.
     Returns : TRUE or throws ObjectMismatch
     Args    : $obj   = an object to test
                       $const = a constant as defined in this package

looks_like_hash()
    Tests if argument looks like a hash.

     Type    : Utility function
     Title   : looks_like_hash
     Usage   : do 'something' if looks_like_hash @_;
     Function: Tests whether argument looks like a hash.
     Returns : hash (same order as arg) or throws OddHash
     Args    : An array of hopefully even key/value pairs

looks_like_class()
    Tests if argument looks like a loadable class name.

     Type    : Utility function
     Title   : looks_like_class
     Usage   : do 'something' if looks_like_class $class;
     Function: Tests whether argument looks like a class.
     Returns : $class or throws ExtensionError
     Args    : A hopefully loadable class name

SEE ALSO
There is a mailing list at <https://groups.google.com/forum/#!forum/bio-phylo> for any user or developer questions and discussions.

Bio::Phylo::Manual
    Also see the manual: Bio::Phylo::Manual and <http://rutgervos.blogspot.com>.

CITATION
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>