tadamec has asked for the wisdom of the Perl Monks concerning the following question:
Fellow monks,
I'm in the process of designing an application and have run into a limit of my Perl knowledge.
I'm attempting to create a handler under mod_perl that would allow me to specify different content generators based upon a configuration file or database entry. For example:
The perl handler should look at the incoming URI and route the request to an instance of the appropriate object, as specified by the config file.### Config file /foo.html = Generator::Foo /bar.html = Generator::Bar /foo/bar = Generator::Baz
I knew the following was broken under strict when I wrote it, but I had to try...
Obviously, $$generator->new(...) won't work with strict, but I can't seem to reason out how to create objects like this on the fly.# $generator is set by reading the above config file. my $g = $$generator->new( $r );
I've checked out the nodes on "Dynamic loading of object-oriented plugins" and "plugins and inheritance" but I didn't seem to find anything that really answered my question.
Thanks for any help!
tadamec
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "Dynamic" object creation.
by PodMaster (Abbot) on Jun 27, 2004 at 07:29 UTC | |
by tadamec (Beadle) on Jun 27, 2004 at 07:34 UTC |