I've encountered an interesting conundrum.

About a week ago, I finally published my work for the first time to the CPAN repository. As a result of that, my throw away little project is suddenly the subject of smoketests, from which I am learning quite a bit about the build process and a little about the challenges of writing portable code. (For instance, I had never used perl Build.PL to install a module. Being a creature of habit, I used make; make test; sudo make install; had it work and never moved past that. Apparently others do it differently.)

At any rate, to my conundrum.

Without use Test::More qw(no_plan);, trying to install my new module on a test box with a base Debian install throws an error reading: Undefined subroutine &skip called at t/perlcritic.t line __. If I use the module but fail to define a plan I get: You tried to run tests without a plan!  Gotta have a plan.. And if I provide a plan, I get, as hoped for:

ok 1 # skip because Test::Perl::Critic required for these tests.

However when I run this test on my development machine, I get:

You tried to plan twice at t/perlcritic.t line 9. # Looks like your test died before it could output anything.

unless I comment out the line required on my test box, in which case the tests run and I get:

1..1 ok 1 - Test::Perl::Critic for "blib/lib/GD/Graph/Thermometer.pm"
So my questions this evening are these:

And the problematic test script, reads:

#!/usr/bin/perl -w use Test::More qw(no_plan); SKIP: { eval 'use Test::Perl::Critic'; skip('because Test::Perl::Critic required for these tests.',1) if $@ +; Test::Perl::Critic::all_critic_ok(); }
Any insight would be appreciated. Thanks,

-- Hugh

UPDATE:

Thanks to jasonk and perrin for what turned out to be the portable working answer. My T::P::C enabled machine, running this test code, returns:

1..1 ok 1 - Test::Perl::Critic for "blib/lib/GD/Graph/Thermometer.pm"
And my base install machine without this dependency, returns:

1..0 # Skip because Test::Perl::Critic required for these tests
That having been resolved, I'll send version 0.05 up to the repository and see what the smoketesters have to say about it next. Thanks everyone for their input and feedback.

if( $lal && $lol ) { $life++; }

In reply to Seeking advice for portable test suite by hesco

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.