
annabel
New User
May 17, 2010, 10:23 PM
Post #1 of 5
(1457 views)
|
|
Create a dynamic Object
|
Can't Post
|
|
I'm trying to create an object dynamically using a string as the object type. It works for me with a simple example: my $string = "Employee"; my $objct = new {$string}("First", "Last", 12345); Employee is a derived class of a Person class. However, with my real code I get an error: Compilation failed in require at studyMngr.pm line 7. The line triggering it is: my $nextStepbjct = new {$nextProcessStep}("name"); What's the difference between the two ways of using a dynamic object is beyond me. I'm on a deadline with this. Help....
|