in reply to Re: Re: Re: Re: Re: Load all modules in directory
in thread Load all modules in directory
Actualy it is not hard at all to picture a case where this behavior is usefull. Take for instance a program that has plugins. It scans that directory and loads all the modules form it, recording there name so it can later list all of the plugins. This can even then be worked so that the module can occasionaly check for new plugins and load them while still running. In this way you could have any type of program that runs 24/7 and you can still update/fix/add plugins on the fly. :-) I've used code like ...
my $temp = $class; $temp =~ s/::/\\/igs; require "$temp.pm"; $self->{bots}->{$name} = $class->new(@args); # create the base cla +ss
That is dynamicaly loading a module based on a name passed to it.
|
|---|