in reply to Re: Dynamically Creating (and Calling) Object Methods
in thread Dynamically Creating (and Calling) Object Methods
...but this does not seem to result in a usable $myDB->method1() as I would like. ("Cannot locate method "method1" via package BigDB....")# $cmd = "method1" eval { no strict 'refs'; *{'BigDB\::$cmd'} = makeCommandSub($CMDS->{$cmd}); } or die "Can't modify the symbol table: $!";
So next I tried hard-coding the new symbol name like so:
and that works! So I just need to know how to use a string as part of the symbol reference. More clues? :-)*BigDB::method1 = makeCommandSub(...);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Dynamically Creating (and Calling) Object Methods
by gaal (Parson) on Jan 07, 2007 at 10:03 UTC | |
|
Re^3: Dynamically Creating (and Calling) Object Methods
by ysth (Canon) on Jan 07, 2007 at 17:57 UTC |