AFAIK no, you can't do it. For performance reasons, CORE
functions never look at the symbol table UNLESS an equivalent CORE::GLOBAL
function has been declared at compile time. Unfortunately, you have to write that CORE::GLOBAL
function and get it just right to simulate the calling conventions of the real function. Some CORE
functions cannot be entirely reproduced without massive hacks, print
and open
for example. Since CORE::GLOBAL
is global an effects all your code and all library code you have to be sure to get it exactly right or cause very hard to debug errors. Some modules, such as autodie, have to go to great lengths to wrap around core functions.
But here, let me show you where the gun locker and ammo are...
my @return = eval "$function(\@args)";
...of course, this is a massive security and maintainability hole. Don't do it.