Joost has asked for the wisdom of the Perl Monks concerning the following question:

Hi.

I'm writing some XS module, and one of the lines I've got staring at me right now is:

INCLUDE: perl generate_includes |
That includes to output of "perl generate_includes" into the XS file. This might cause problems because it assumes that perl is in the current path and that the perl interpreter found is the one that is currenly used to compile to.

I would rather use the interpreter that is used in the generated makefile (i.e. FULLPERL). Hints anyone?

Replies are listed 'Best First'.
Re: Getting the current perl interpreter while processing XS
by rafl (Friar) on Sep 19, 2006 at 17:56 UTC

    Both xsubpp and ExtUtils::ParseXS pass the argument to INCLUDE directly to open() without preprocessing it. You could either preprocess your .xs file from Makefile.PL and fill in the path to the perl executable or you could probably use ExtUtils::ParseXS to write your own xsubpp which uses an overwritten open() function to do something special if it gets something like "$(PERLRUN) script.pl".

    Cheers, Flo