in reply to Thorny design problem

I have done something really similar for about 10 Firms. I choice the Module way, where all Modules derive from one with the API. I call the modules never directly. They are created/loaded from the base module.
my $m = Church->new('GeneralMotors') or die; # $m is Church::GeneralMotors
I'm very happy with this method. Propably you need nerly no code to implement Church::BMW derived from Church::GeneralMotors.
Boris

Replies are listed 'Best First'.
Re^2: Thorny design problem
by polettix (Vicar) on Sep 07, 2005 at 22:16 UTC
    Your factory approach is clean, but it seems like you're just moving tlm's problem from one place to another. How is Church::new implemented?

    Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Don't fool yourself.
      package Church; sub factory_create { my ( $class, %p ) = @_; my $new_class = ref($class) || $class . "::" . $p{firm}; eval "require $new_class" or die $@; return $new_class->new(%p); }
      Boris