in reply to Re: Inline::* and string eval -- Have I found a place where it might actually be necessary?
in thread Inline::* and string eval -- Have I found a place where it might actually be necessary?

Aha, brilliant! That was the syntax for reaching into the package symbol table that I couldn't quite wrap my mind around.

I ended up having to use: my $sub = \&{"Lua::${module}::${funcname}"}; though, of course, to separate the :: from the variable names. So, that's one string eval gone!

Thank you.

  • Comment on Re^2: Inline::* and string eval -- Have I found a place where it might actually be necessary?
  • Download Code

Replies are listed 'Best First'.
Re^3: Inline::* and string eval -- Have I found a place where it might actually be necessary?
by ikegami (Patriarch) on Dec 26, 2008 at 10:22 UTC
    It can also be done via %::
    \&{ $::{'Lua::'}{$module.'::'}{$funcname} };

    but no strict 'refs'; is a lot easier.

    By the way, Module::Pluggable is now part of core. I'd use that over playing with the symtab if applicable.

      Aha, the first code snippet explains the syntax errors I was getting, thanks.

      I don't think Module::Pluggable will be applicable here, because of the way Inline works, but it's useful to know it's in core now, as I think I can find a use for it elsewhere :-)