http://qs1969.pair.com?node_id=1195024

cLive ;-) has asked for the wisdom of the Perl Monks concerning the following question:

Finally got around to uploading my first CPAN module. The nightly test email is still rather exciting - and I'm learning more from this than I thought.

One thing is that strictures doesn't appear to be in core on some versions of perl.

PERL_DL_NONLAZY=1 "/home/cpan/pit/bare/perl-5.14.0/bin/perl" "-MExtUti +ls::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switch +es; test_harness(0, 'blib/lib', 'blib/arch')" t/tests/*/*/*.t t/tests +/*/*/*/*.t t/tests/*/*/*/*/*.t Can't locate strictures.pm in @INC (@INC contains: ##huge @INC removed +##.) at t/tests/lib/Number/MuPhone.t line 1. BEGIN failed--compilation aborted at t/tests/lib/Number/MuPhone.t line + 1. t/tests/lib/Number/MuPhone.t .............. Dubious, test returned 2 (wstat 512, 0x200) No subtests run

From this page I assume I can fix this by adding use 5.012 to the module, yes? Is that the preferred way of "fixing" this for the tests?

Replies are listed 'Best First'.
Re: Correct way to use stricures in CPAN module
by toolic (Bishop) on Jul 13, 2017 at 14:16 UTC
    That Perl.com article you reference states:
    Perl 5.12 also enables strictures when it encounters use 5.012

    I think the confusion is that the term "strictures" in the article loosely refers to the strict and warnings pragmas, which are part of the Core Perl distribution. The term does not refer to the strictures.pm module, which Corion pointed out is not part of the Core.

    Adding use 5.012; will add strict and warnings, but it will not add strictures.

    UPDATE: corrected mistake.

    For giggles... The strictures, according to Seuss

      Adding use 5.012; will add strict and warnings

      Not quite, use with a version ≥ 5.012 doesn't enable warnings, just strict.

Re: Correct way to use stricures in CPAN module
by Corion (Patriarch) on Jul 13, 2017 at 13:55 UTC

    strictures was never in core:

    g:\Systeme\Regis-TR\XML>corelist strictures strictures was not in CORE (or so I think)

    You should specify such prerequisites in your Makefile.PL (and from there, in your META.yml and META.json):

    ... PREREQ_PM => { strictures => 0, ...

    Debugging your list of prerequisites is always fun :)

      I noticed there was an omission in my prerequisites for YAML::XS (but I made that optional through an eval, so I figured that was fine).

      Good to know strictures needs to be in the prereq list, but I'm wondering why Makefile.PL didn't pick it up. Hmmm.

Re: Correct way to use stricures in CPAN module
by perlancar (Hermit) on Jul 13, 2017 at 14:43 UTC
    Congratulations, BTW!
      I've only had a PAUSE account for 15 years! :D