[Israel.pm] symbolic references and class names

Yossi Itzkovich Yossi.Itzkovich at ecitele.com
Sun Feb 25 02:27:49 PST 2007


I would like to write a method that gets  class name as a parameter and
creates an object of this class with a parameter.

For example, for class MyClass I should have something like:

sub factory
my ($className,$param)=@_;

my $returnValue= new {$className}($param);

This syntax doesn't work, and I can't find something that works.  Can
someone help me?



More information about the Perl mailing list