[Israel.pm] symbolic references and class names

Yossi Itzkovich Yossi.Itzkovich at ecitele.com
Mon Feb 26 03:07:15 PST 2007


Hi,

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?

Thanks

Yossi




More information about the Perl mailing list