ActiveState Testing Fails My Module on Non-Windows Platforms...problem with $^O ?

Posted by brightledsigns on 2013-03-09 10:49
Forums: PPM | OS: All / Any

I just released a perl module, and noticed that ActiveState does some automated testing.

It passed testing on your Windows machines, but failed on all non-windows machines.

I looked at the test results, and it appears that it's some sort of oddity where the perl $^O variable is set to "MSWin32", even when you test on non-windows platforms. At least that's what I'm guessing is going on.

My module uses $^O in the Build.PL script to decide whether to mark Win32::SerialPort as a prerequisite, or to use Device::SerialPort. That setup works fine when I install the module by hand on a non-windows only seems to be failing under ActiveState testing on non-windows machines.

Here's the Build.PL, so you can see what I mean:

And here's your grid showing my module failing on everything but windows boxes:

Here's one example where it fails on a linux machine:

You can see it's trying to build Win32::SerialPort as a dependency, which of course, fails. This doesn't happen if I build it myself on a Linux box, so I'm assuming there's some oddity where ActiveState perl hard sets $^O to "MSWin32" on all platforms? Or maybe it's specific to your test environments?

Is this something that can be changed?

Or is there something different I can do?

brightledsigns | Sat, 2013-03-09 11:40

I unintentionally included a Makefile.PL in the distribution, which was generated on windows by Module::Build. When I install the module myself, it uses the Build.PL. Your testing uses the Makefile...thus exposing my error :)

brightledsigns | Sat, 2013-03-09 18:15

For what it's worth, there doesn't seem to be a good way to, for example, conditionally create either "Win32::SerialPort" or "Device::SerialPort" as a hard prerequisite.

I ended up putting conditional statements into both Build.PL and Makefile.PL, but Module::Build still hardcodes the META files. Similar for other perl module builder helpers, like Module::Install.

It should build okay now, with the conditionals in both Build.PL and Makefile.PL, but the metadata/info on CPAN won't be right.

Not an activestate issue in any way, but certainly confusing.