in reply to Dynamic inheritance with Moose?

Module::Pluggable::Object and Class:MOP should be a good start. There's an example of doing this in the new Catalyst book. Something along the lines of this (not-tested code) should work

my $mp = Module::Pluggable::Object->new( search_path => [ "/path/to/classes" ] ); my @classes = $mp->plugins; # choose which class from classes Class::MOP::load_class( $class ); return $class->new;
Depending on how your search_path is, you may need to muck with the class name before calling new (like strip off the leading path).

-derby

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

    thanks for your advice.
    I used the hint Anonymous Monk gave me and it worked but I'll look into your solution as well. Perhaps I'll need it one day and it's never a bad idea in perl to know more than one way to do it :D

    Thanks again for your help!

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