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:
So my questions this evening are these:1..1 ok 1 - Test::Perl::Critic for "blib/lib/GD/Graph/Thermometer.pm"
Any insight would be appreciated. Thanks,#!/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(); }
-- 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:
And my base install machine without this dependency, returns:1..1 ok 1 - Test::Perl::Critic for "blib/lib/GD/Graph/Thermometer.pm"
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.1..0 # Skip because Test::Perl::Critic required for these tests
In reply to Seeking advice for portable test suite by hesco
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |