[Israel.pm] symbolic references and class names
Gaal Yahas
gaal at forum2.org
Wed Feb 28 15:54:39 EET 2007
On Sun, Feb 25, 2007 at 12:27:49PM +0200, Yossi Itzkovich wrote:
> 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?
$className->new($param);
--
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/
More information about the Perl
mailing list