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($File::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(/\./, $superclass[$#superclass])}[0]; $self->logObj->log(location => 'Initialisation', message => 'loaded: '.$File::Find::name); } }