Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

drhyde (1683)

  (email not shown publicly)

Journal of drhyde (1683)

Monday October 01, 2007
04:26 AM

Devel::CheckOS and Devel::AssertOS released

[ #34579 ]

Last night I released Devel::CheckOS and Devel::AssertOS. They are a wrapper around $^O with some extra functionality. For example, where you can check $^O's value to see if you're running on a Linux system, you can use these modules to check for OS 'families' as well, such as whether you're running on a Unix system.

Devel::CheckOS provides functions which return true or false depending on whether there's a match. Devel::AssertOS dies when you try to use it if there's no match.

The intention is that authors will use these modules whenever they write platform-specific code so that it will die with an appropriate message, which will be picked up by CPAN testers, and make them SHUT THE HELL UP when they try to do stupid things like test Solaris::Foo on Linux or VMS::Bar on Windows.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Why two modules rather than one with an option?

    It seems like a complete waste to me. More work for packagers, more wasted space on CPAN, bigger CPAN indexes, more modules and idiotic dependencies for people unlucky enough to try installing something that depends on a gazillion modules (like many Perl things does these days).

      - ask

    -- ask bjoern hansen [], !try; do();

    • It's two modules because merely asking "is this a Unix system?" is different from asserting that "this must be a Unix system". Actually, CheckOS can do the assertion as well, but I thought that cutting the amount of code required to make the assertion to the absolute minimum would be a good idea seeing that that will, I think, be the most common usage.

      Dependency hell? Hardly. Declare it as a pre-requisite and will do the business. If you're not using to fetch and install dependencies t

    • For this to work in a Makefile.PL or Build.PL, it can't be an ordinary dependency. It will either need to be a "configure_requires" -- for which support is only available in recent versions of CPAN, or it will need to be bundled into an "inc" directory -- the preferred course, I think.

      # Makefile.PL
      use lib 'inc';
      use Devel::AssertOS::Unix;

      # rest of Makefile.PL follows;

      This would ensure that the OS is a Unix variant or else it will die (signaling to CPAN to stop with build/test/install) and with a prope

      • The shiny new File::Find::Rule::Permissions I released uses Devel::AssertOS::Unix in the module. So it'll get as far as trying to run the tests on non-Unix platforms, then bail out with 'OS unsupported', which is close enough for now.

        Schwern has mumbled about releasing some inc thingy for EU::MM. Perhaps in the mean time I should add a 'add_develassertos_inc' script to the distribution which would do everything necessary to a Makefile.PL in the current directory:

        $ add_develassertos_inc FreeBSD NetBSD