http://www.perlmonks.org?node_id=35782

dcorbin has asked for the wisdom of the Perl Monks concerning the following question:

I'm do tolerably well with Perl Objects but I'm not a guru and I haven't read Conway's book.

I'm looking for an example that will help me through the following (expressed in generic OO terms):

Consider an abstract base class B, and derived classes D1 and D2. I'd like to have factory that instantiates the correct object type (D1 or D2) based on some input argument (Assume the class names are based on the argument. In this example, the argument would be 1 or 2). Thanks.