in reply to Dynamic inheritance with Moose?

You can still build a system with Moose and dynamically include other modules via require. I don't see why you would want to use "dynamic inheritance," however -- simple aggregation should get the job done and those classes could inherit from a base class. Better yet -- try Moose::Role.

If you have more questions, please consider posting some code for reference.

Replies are listed 'Best First'.
Re^2: Dynamic inheritance with Moose?
by Shinama (Acolyte) on Aug 07, 2009 at 07:20 UTC
    Hello Anonymous,

    It now works, thanks to Moose::Role. I tried Moose::Role before but it didn't work. I think I made some errors with the namespaces of the files...
    I thought about using a "simple" require but I can't stand the thought of using something that's not included in the Framework. I mean where's the point in using it if you just write the code like you did before?

    Another error I made was calling make_immutable on the controller-class which results in an error because inheritance is not working after calling it (no sureprise, if I think about it ;( ).

    Here's the part of my programm which includes the other class (as a role) and then calles the corresponding config_module sub in the inherited class.

    sub load_config { my $self = shift; my $to_load = shift; with "LaborBelege::AddOns::$to_load\::main"; $self->config_module(); }
    Thanks for your advice, it finally got me on the right track.

    Greetings from Germany,
    Shinama
    ---------------------------------------------------
    "You read too much and understand too little."
    Moiraine Damodred (The Wheel of Time)