Detect the OS Perl Code is Running Under

I was looking into updating a couple of my perl modules because rt.cpan.org is being sunset early in 2021. As part of this I thought it was time to stop cpan testers from testing my module under Windows since it is currently not really supported.

I was not sure how to go about doing this, so I reached out the good people in the “Perl Programmers” group on FaceBook. I got some great links and suggestions. In order to make this easy for me to find. I am documenting some of them here.

  1. Top of Makefile.PL
die 'kaput' if ($^O eq 'MSWin32');
  1. Stackoverflow
    https://stackoverflow.com/questions/334686/how-can-i-detect-the-operating-system-in-perl?fbclid=IwAR3VcUcuYIaA6QzN42Z679nZMWr7rDUudfv42WmSBJ7VCn-x6AJgt2iaAaU

  2. Sample for Skipping Mac OS
    https://metacpan.org/source/LNATION/Mac-OSA-Dialog-Tiny-1.00/Makefile.PL?fbclid=IwAR0up4BQlL5iNU1cyF9dZ_eggLSxu2g5IJLfLN2-2HtOD9X-5MCpvsKuxHk#L7

  3. Some links from Erki
    https://github.com/RexOps/Rex/blob/master/dist.ini?fbclid=IwAR3a1QSMCVCB3l33bX9ohvCDPdmkD6A65KGVzdQEEcUJyPiLKfLbmRws8aE#L23-L25 https://github.com/RexOps/Rex/blob/master/misc/check_supported_OS.pl?fbclid=IwAR0Xocwz2ghPs_FLaUNCUuDqeSbzdkwuUD-92BScTeTTb6JTk5cn58ZFK-w

perl  os  detection 

See also