Sisyphus wrote:
Hi,

I'm wanting to insert my own sub MY::xs_o() into a Makefile.PL, but I want the sub to be visible only if $Config{make} eq 'nmake'.

So I wrote in the Makefile.PL:

if($Config{make} eq 'nmake') {
  sub MY::xs_o {"text to insert in Makefile"}
}

That worked fine - except that sub MY::xs_o() is visible (and is enacted) even if $Config{make} is *not* 'nmake'.

Is there a way I can get the behaviour I'm after ?


Well ... one way is to write my 'sub MY::xs_o' into an external file (let's call it 'for_nmake.MY') and then in the Makefile.PL put:


if($Config{make} eq 'nmake') {require 'for_nmake.MY'}

That seems to work ok, and will do quite nicely - unless there's a way of doing it that doesn't require an external file.

Cheers,
Rob



Reply via email to