GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  BIO::PHYLO::FACTORY (3)

.ds Aq ’

NAME

Bio::Phylo::Factory - Creator of objects, reduces hardcoded class names in code

CONTENTS

SYNOPSIS



 use Bio::Phylo::Factory;
 my $fac = Bio::Phylo::Factory->new;
 my $node = $fac->create_node( -name => node1 );

 # probably prints Bio::Phylo::Forest::Node?
 print ref $node;



DESCRIPTION

The factory module is used to create other objects without having to ’use’ their classes. This allows for greater flexibility in Bio::Phylo’s design, as class names are no longer hard-coded all over the place.

METHODS

    CONSTRUCTOR

new() Factory constructor.



 Type    : Constructor
 Title   : new
 Usage   : my $fac = Bio::Phylo::Factory->new;
 Function: Initializes a Bio::Phylo::Factory object.
 Returns : A Bio::Phylo::Factory object.
 Args    : (optional) a hash keyed on short names, with
           class names for values. For example,
           node => Bio::Phylo::Forest::Node, which
           will allow you to subsequently call $fac->create_node,
           which will return a Bio::Phylo::Forest::Node object.
           (Note that this example is enabled by default, so you
           dont need to specify it.)



    FACTORY METHODS

create($class, %args)


 Type    : Factory methods
 Title   : create
 Usage   : my $foo = $fac->create(Foo::Class);
 Function: Creates an instance of $class, with constructor arguments %args
 Returns : A Bio::Phylo::* object.
 Args    : $class, a class name (required),
           %args, constructor arguments (optional)



register_class() Registers the argument class name such that subsequently the factory can instantiates objects of that class. For example, if you register Foo::Bar, the factory will be able to instantiate objects through the create_bar() method.



 Type    : Factory methods
 Title   : register_class
 Usage   : $fac->register_class(Foo::Bar);
 Function: Registers a class name for instantiation
 Returns : Invocant
 Args    : $class, a class name (required), or
           bar => Foo::Bar, such that you
           can subsequently call $fac->create_bar()



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:

<B>Rutger A VosB>, <B>Jason CaravasB>, <B>Klaas HartmannB>, <B>Mark A JensenB> and <B>Chase MillerB>, 2011. Bio::Phylo - phyloinformatic analysis using Perl. BMC Bioinformatics <B>12B>:63. <http://dx.doi.org/10.1186/1471-2105-12-63>

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 BIO::PHYLO::FACTORY (3) 2014-02-08

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.