in reply to Re: Dynamically load unknown modules
in thread Dynamically load unknown modules
general: long but full lines are always hard to read.
#example: your call of find() find ( { no_chdir => 1, wanted => sub { $self->load_api_modules($File::Find::name) }, follow =>1 }, 'api');
Allow me to rewrite them load_api_modules() method:
sub load_api_modules { my $self = shift; my $file = shift; local $_ = $file;#will work with $_ and keep $file return unless s/\.pm$//; require $file; my @sup = split m#/#; # s#/#::#g; unneccessary $self->{ $sup[1].$sup[2] } = $sup[@sup-1]->new(); $self->logObj->log( location => "Initialisation", message => "loaded: $file" ); }
HTH
--
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Dynamically load unknown modules
by Ryszard (Priest) on Aug 28, 2002 at 08:29 UTC |