in reply to dynamically creating variables named after the contents of an array

I think I may have done something similar to what you want here. The basic idea is to create a new instance of an object at runtime, as opposed to compile time.

My solution uses file::find to go out and search for modules, then create a new instance of them.

The literal idea is to be able to create new modules to do different tasks, so you can bounce the server, and it will pick up the new modules automatically. Each module has the same method names, so the main object doesnt have to be aware of any extra method names..

Anyways, back to the main point, the code snippet i settled on puts a new instance of an obects into $self, based on a variable passed to the method.

I'm not sure why this would be a maintaince nightmare as merlyn suggested, as the code is self explanitory and the "unknown" modules are in a central repository - perhaps i've missed the point somewhere along the way...

  • Comment on Re: dynamically creating variables named after the contents of an array

Replies are listed 'Best First'.
Re: Re: dynamically creating variables named after the contents of an array
by Anonymous Monk on Sep 07, 2002 at 21:02 UTC
    Read all 3 articles in the discussion starting here and you may understand merlyn's comments better.