Ok, after hacking about a bit I've found this snippet does what i want.

Code review invited (yes i'm going to change the name of "superclass").. :-)

sub post_configure_hook { my $self = shift; $self->logObj( Logger->new(name => 'log/gaa') ); $self->xml( new XML::Simple(xmldecl => 1,forcearray => 1) ); # Go find all the modules find ({no_chdir => 1, wanted => sub { $self->load_api_modules($Fil +e::Find::name) }, follow =>1}, 'api'); } sub load_api_modules{ my $self = shift; my $filename = shift; if ($filename =~ /\.pm$/) { my @superclass = split(/\//, $filename); require "$filename"; my $name = $filename; $name =~ s#/#::#g; # Convert slashes (/) to :: substr($name, -3,3, ''); # Remove the .pm at the end $self->{$superclass[1].$superclass[2]} = new {split(/\./, $sup +erclass[$#superclass])}[0]; $self->logObj->log(location => 'Initialisation', message => 'l +oaded: '.$File::Find::name); } }

In reply to Re: Dynamically load unknown modules by Ryszard
in thread Dynamically load unknown modules by Ryszard

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.