in reply to OO: Factory vs. "Seed" (?) pattern

Let's turn this on its head. Basically, you're saying

In other words, you have

my $obj = Foo->bar( @params ); isa_ok( $obj, 'Foo::Child' );
A factory does not need to be an object, regardless of whatever anyone told you. A factory can be a class. You have a factory pattern and it makes perfect sense. I have a very similar setup in Excel::Template with Excel::Template::Factory. I pass it a nodename and it gives me back an object that represents the node. That is the definition of a factory. Whether it's a class method or an object method is a function of whether or not you need more than one factory running at the same time.

  • In general, if you think something isn't in Perl, try it out, because it usually is. :-)
  • "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"