in reply to Re: CPAN newbie troubles
in thread CPAN newbie troubles

* Your first test throws an exception. * You OS test fails. * BAIL_OUT causes the process to exit with a non-successful return.

As I understood it, that's what I'm supposed to do. According to the "Notes For CPAN Authors" page, in the ""How can I indicate that my distribution only works on a particular operating system?" section, it says

While it isn't a very elegant solution, the recommend approach is to e +ither die in the Makefile.PL or Build.PL (or BAIL_OUT in a test file) + with one of the following messages: • No support for OS • OS unsupported CPAN Testers tools will look for one of those phrases and will send an + NA (Not Available) report for that platform.

That's what I'm doing. 'make test' works fine on my system as well as a NetBSD system that I can access; if I change the above OS test to include Linux, it bails properly at that time.

Or maybe you're really trying to do something other than confuse would-be users.

That's unnecessarily and pointlessly unkind as well as somewhat nonsensical. What does a test, which is supposed to prevent installation on non-compliant OSes, have to do with "confusing users"? It explicitly bails on systems that are not supported, which would prevent confusion.

My point is that is should fail on a Windows system, but it should not result in a 'FAIL'ed test from CPANtesters (which, in theory at least, should bail on testing any of the unsupported OSes and test the ones that don't abort.) I am NOT asking "how do I make this not fail on Windows". I am asking "how do I tell CPANtesters that it should not test on Windows, etc. platforms?"

-- 
Education is not the filling of a pail, but the lighting of a fire.
 -- W. B. Yeats

Replies are listed 'Best First'.
Re^3: CPAN newbie troubles
by ikegami (Patriarch) on Jan 05, 2011 at 00:06 UTC

    As I understood it, that's what I'm supposed to do.

    I didn't know that. That means you can ignore the third bullet, and maybe the second one too. The first one still applies, though. If you don't reach BAIL_OUT, how can it do what it should do?

    What does a test, which is supposed to prevent installation on non-compliant OSes, have to do with "confusing users"?

    That's not what the code in question does at all. It silences the test failures.

    You weren't very clear about what you wanted to do in your original post. It looked to me like you were trying to skip all tests, but I knew I could have guessed wrong. That's why I provided alternative answers. Based on what you say now, the relevant answer is

    You'll need to muck around with Makefile.PL.

    if ($^O =~ /^(?:MSWin|VMS|dos|MacOS|os2|epoc|cygwin)) { die "OS unsupported\n"; }
      die "OS unsupported\n";

      I've seen it somewhere that, in this instance, you need the Makefile.PL to exit(0). I think a die() in the Makefile.PL still results in a 'FAIL' report (or, at least, has some undesirable consequence).

      Cheers,
      Rob

        No, it's a special case. The code is copied from Win32 and it's explicitly mentioned in the CPAN documentation the OP is quoting.

        the recommend approach is to either die in the Makefile.PL or [...] with one of the following messages: [...]OS unsupported.

        Emphasis mine.

        Sample NA report from die "OS unsupported\n".

        Update: Added last paragraph.

      That's not what the code in question does at all. It silences the test failures.

      You're wrong, I'm afraid.

      # After adding 'linux' to the 'unsupported OS' list $ make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_h +arness(0, 'blib/lib', 'blib/arch')" t/*.t t/Term-Menu-Hierarchical.t .. 1/2 Bailout called. Further testing sto +pped: OS unsupported # Failed test at t/Term-Menu-Hierarchical.t line 17. FAILED--Further testing stopped: OS unsupported make: *** [test_dynamic] Error 255

      Even though 'test_harness' has '0' for the 'verbose' argument, 'make test' clearly and explicitly throws the specified error.

      You weren't very clear about what you wanted to do in your original post.

      Hopefully, it's clear enough now.

      You'll need to muck around with Makefile.PL.

      I quote, again, from the CPAN Wiki (emphasis mine):

      "How can I indicate that my distribution only works on a particular operating system?"
      
      While it isn't a very elegant solution, the recommend approach is to either die in the Makefile.PL or Build.PL (or BAIL_OUT in a test file) with one of the following messages:
      
        • No support for OS
        • OS unsupported
      
      CPAN Testers tools will look for one of those phrases and will send an NA (Not Available) report for that platform.
      

      Thanks for trying. Perhaps someone who is actually familiar with the process will have a good answer.

      -- 
      Education is not the filling of a pail, but the lighting of a fire.
       -- W. B. Yeats

        You're wrong, I'm afraid.

        I have no idea what you're running, but it's obviously not my code. On linux with linux added to the list:

        $ PERL_DL_NONLAZY=1 perl "-MExtUtils::Command::MM" "-e" "test_harness( +0, 'blib/lib', 'blib/arch')" a.t a.t .. skipped: OS unsupported. It may or may not work, but you won't +know since the tests are being skipped. Use at your own risk Files=1, Tests=0, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.02 cusr + 0.00 csys = 0.04 CPU) Result: NOTESTS

        Clearly that would confuse would-be users.

        I quote, again, from the CPAN Wiki (emphasis mine):

        And for the third time, you never call BAIL_OUT on Windows because you never reach it.

        Thanks for trying. Perhaps someone who is actually familiar with the process will have a good answer.

        Are you saying my solution doesn't work? I seriously doubt that since I copied it from a well used module AND it's mentioned in the documentation you keep quoting.