in reply to Re^2: Dynamically Creating (and Calling) Object Methods
in thread Dynamically Creating (and Calling) Object Methods
eval { 0 } or die "this dies, but not because of an exception in the i +nner block!";
Finally, $! is wrong in this case, you need $@ for the exception.
But to your real question:
You said 'BigDB\::$cmd'. But because of the single quotes, this creates literally a '$cmd' package in BigDB's symbol table! (Check by printing keys %BigDB::.) The correct code is
*{"BigDB::$cmd"} = ...
You probably got the backslash from code that used a variable containing the caller, where it's needed to make Perl not think you're talking about a fully qualified variable:
*{"$caller\::methodname"} = ...
|
|---|