in reply to Re^2: XS: use module into package
in thread XS: use module into package

I don't think so, but it's moot. The reason you had to use eval in code doesn't go away by loading the module using a different interface. You can't go and change the package the parent Perl code was compiled into.

Replies are listed 'Best First'.
Re^4: XS: use module into package
by Anonymous Monk on Jun 13, 2011 at 18:54 UTC
    But the code the eval executes is being parsed into a sequence of API calls that finally end up changing the caller package by using a module into it. I'm looking for these API functions.

    Except that maybe these are not "API" calls, but really internal stuff not meant for the general public.

      You can't go and change the package the parent Perl code was compiled into. You have to create new code and have it executed by Perl. Perl code gets compiled into ops, not API calls. package itself doesn't even result in an op because it's compiler directive. It changes the package Perl code gets compiled into.

        Well, I was thinking of doing this during compilation, ie in a BEGIN code block or in my import sub. For instance:
        package Mycaller; use MyModule; ...

        That way MyModule would be called during compilation, even pefore the rest of the calling module has even been parsed.

        My intention is to make the caller package use something else... without an eval.