thanos1983 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I finally manage to upload my module on CPAN (Net::SNTP::Client).

Although that I tried to verify all test cases would go green before uploading the module, this error came up. I can only assume that is a minor fix since it is not related with the tests that I have written.

Ok then further analysis, of problem replication. I got suggestion of a fellow monk kcott on steps to follow when building a new module ref (Step-by-step: Making the module). Well everything looked good after the make test (locally) got Pass.

Previously I was building the module with h2xs which was creating the same files apart from the /t (Test directory). Before I had one file named NET-SNTP-CLIENT.t where all the test cases where located.

By using the Module::Starter module to build my module, in the /t directory I got 4 files (00-load.t, manifest.t, pod.t, pod-coverage.t). I placed all my test cases inside 00-load.t, I assume this is the correct directory because when I execute make test I get:

Sample of make test:

Skip blib/lib/Net/SNTP/Client.pm (unchanged) PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::H +arness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/l +ib', 'blib/arch')" t/*.t t/00-load.t ....... 1/? # Testing Net::SNTP::Client 0.01, Perl 5.01800 +2, /usr/bin/perl t/00-load.t ....... ok t/manifest.t ...... skipped: Author tests not required for installatio +n t/pod-coverage.t .. skipped: Author tests not required for installatio +n t/pod.t ........... skipped: Author tests not required for installatio +n All tests successful. Files=4, Tests=15, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.11 cusr + 0.01 csys = 0.15 CPU) Result: PASS

Which indicates that all test were OK. But when I uploaded the module I got the following error from 5 different test cases.

Sample of output error:

------------------------------ PROGRAM OUTPUT ------------------------------ Output from '/usr/bin/make test': PERL_DL_NONLAZY=1 "/home/sand/src/perl/repoperls/installed-perls/perl/ +perl-5.10.1/5da8/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness +" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', ' +blib/arch')" t/*.t Type of arg 1 to keys must be hash (not private variable) at t/00-load +.t line 95, near "$hashRefOutput;" Execution of t/00-load.t aborted due to compilation errors. # Tests were run but no plan was declared and done_testing() was not s +een. # Looks like your test exited with 255 just after 1. t/00-load.t ....... Dubious, test returned 255 (wstat 65280, 0xff00) All 1 subtests passed t/manifest.t ...... skipped: Author tests not required for installatio +n t/pod-coverage.t .. skipped: Author tests not required for installatio +n t/pod.t ........... skipped: Author tests not required for installatio +n Test Summary Report ------------------- t/00-load.t (Wstat: 65280 Tests: 1 Failed: 0) Non-zero exit status: 255 Parse errors: No plan found in TAP output Files=4, Tests=1, 0 wallclock secs ( 0.03 usr 0.02 sys + 0.09 cusr + 0.02 csys = 0.16 CPU) Result: FAIL Failed 1/4 test programs. 0/1 subtests failed. Makefile:818: recipe for target 'test_dynamic' failed make: *** [test_dynamic] Error 255

After searching on the web I only found this PAUSE problem. Unfortunately I can get that much of information out of it. The error looks the same, and from what I see someone did create a ticket on how to solve it.

From PAUSE problem

I was getting the above errors on Debian 6.0. It worked for me after applying the patch.

Does anyone has an idea how to fix this problem? I just download the module from CPAN and install it locally (LinuxOS) seems I did not got any errors.

Thank you everyone for your time and effort.

Seeking for Perl wisdom...on the process of learning...not there...yet!

Replies are listed 'Best First'.
Re: Tests were run but no plan was declared and done_testing() was not seen.
by toolic (Bishop) on Jul 10, 2015 at 18:30 UTC
    t/00-load.t line 95, near "$hashRefOutput;
    This is line 95:
    my @gotHashRefKeys = keys $hashRefOutput;
    I'm using Perl version 5.12, and I get this error. My version of keys shows:
    keys HASH keys ARRAY

    The latest docs also support keys EXPR:

    Starting with Perl 5.14, keys can take a scalar EXPR, which must contain a reference to an unblessed hash or array.
    This test is not portable across all versions run by CPANTesters.
      You can use Syntax::Construct to find out, or even to tell Perl and fellow programmers reading your code:
      use Syntax::Construct qw{ auto-deref };
      End of blatant boasting plug
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
        Syntax::Construct looks like a useful tool. All useful tools should be promoted.

        However, after reading the POD, it is not clear to me why I should use it. I understand that I can add this line to a Perl file...

        use Syntax::Construct qw( // ... /r );
        and it will give me a message like:
        Unsupported construct /r at ... line ... (Perl 5.014)
        I am running on Perl version 5.12. Is this telling me that the /r construct was added in Perl version 5.014? If so, I find that very helpful. However, can you elaborate on the qw( // ... /r )? It's not clear from the POD why you chose that. Is that guaranteed to cover all the constructs supported by the module?

        Regarding use Syntax::Construct qw{ auto-deref };, if I am using 5.14 (which supports keys EXPR), does this alter the behavior of my code with keys $foo?

      Hello toolic,

      Once more you nailed it ;)

      I will update the module asap, I am also planning to update the documentation, it looks funny to me. :D

      Again, thank you for your time and effort I appreciate it.

      Seeking for Perl wisdom...on the process of learning...not there...yet!
Re: Tests were run but no plan was declared and done_testing() was not seen.
by stevieb (Canon) on Jul 10, 2015 at 18:50 UTC

    As toolic stated, older versions of keys() forced you to hand it a hash (not a hash reference).

    To fix this, simply dereference your hash:

    my @gotHashRefKeys = keys %$hashRefOutput;

    or, if you prefer

    my @gotHashRefKeys = keys %{ $hashRefOutput };

    As you are finding, CPAN testers is fantastic for checking that your code is backward compatible.

    A note from perldoc -f keys (as of 5.18.0):

    This aspect of "keys" is considered highly experimental. The exact behaviour may change in a future version of Perl.

    So probably best to pass in the dereferenced hash ref, or in the future you may find the tests breaking pre-5.14.0 and post any changes to keys().

    -stevieb

      Hello stevieb,

      I appreciate the time and effort you spend on testing my module and also providing the solution. :D

      I will update the module asap, I am also planning to update the documentation, it looks not clear to me. :D

      Again, thank you for your time and effort I appreciate it. :D

      Seeking for Perl wisdom...on the process of learning...not there...yet!

        You're welcome. Just remember to bump your version numbers after each change you upload to CPAN. CPAN won't accept a file that has the same name as a previous file, and the file name has to have your version number in it.

        Cheers,

        -stevieb

Re: Tests were run but no plan was declared and done_testing() was not seen.
by 1nickt (Canon) on Jul 10, 2015 at 18:21 UTC

    Can't help with your problem, except that it all tested and installed fine on my Macbook :-)

    PERL_DL_NONLAZY=1 "/Users/nick/perl5/perlbrew/perls/perl-5.16.0/bin/pe +rl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Ha +rness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/00-load.t ....... 1/? # Testing Net::SNTP::Client 0.01, Perl 5.01600 +0, /Users/nick/perl5/perlbrew/perls/perl-5.16.0/bin/perl t/00-load.t ....... ok

    You should either have a test plan or declare done_testing in 00-load.t

    Remember: Ne dederis in spiritu molere illegitimi!

      Hello 1nickt,

      I appreciate your time and effort. Thanks a million for testing the module on MacOS I did not had the ability to do that... :D

      I am glad that is working fine hope you can apply it some where... :D

      Again thank you for your time and effort, spending reviewing my module.

      Seeking for Perl wisdom...on the process of learning...not there...yet!

        You are welcome. Here is the output of your test t/00-load.t when it failed because my network router was rebooting when I ran it:

        [12:48][nick:~/.cpan/build/Net-SNTP-Client-0.01-4Dgp0y]$ perl -T t/00- +load.t ok 1 - use Net::SNTP::Client; # Testing Net::SNTP::Client 0.01, Perl 5.016000, /Users/nick/perl5/per +lbrew/perls/perl-5.16.0/bin/perl ok 2 - Module Hash Input Works ok 3 - Hostname Must be Defined ok 4 - Port Has to be Defined and Integer ok 5 - Got Hash Output not ok 6 - Module Hash Keys are Identical # Failed test 'Module Hash Keys are Identical' # at t/00-load.t line 97. # Structures begin differing at: # $got->[0] = '-hostname' # $expected->[0] = '0.pool.ntp.org' not ok 7 - Exptected Output From the Module Received # Failed test 'Exptected Output From the Module Received' # at t/00-load.t line 99. # Comparing hash keys of $data # Missing: '0.pool.ntp.org', 'RFC4330', 't/00-load.t' # Extra: '-hostname', '-port' ok 8 - Faulty Test Extra Key ok 9 - Correct Output Error Extra Hash Key ok 10 - Faulty Test no Hostname ok 11 - Correct Output Error No Hostname ok 12 - Faulty Test Negative Port Number ok 13 - Correct Output Error for Negative Port Number ok 14 - Faulty Test Out of Range Port Number ok 15 - Correct Output Error Out of Range Port Number 1..15 # Looks like you failed 2 tests of 15.

        Here is the output when I ran it with net connection:

        [12:51][nick:~/.cpan/build/Net-SNTP-Client-0.01-4Dgp0y]$ perl -T t/00- +load.t ok 1 - use Net::SNTP::Client; # Testing Net::SNTP::Client 0.01, Perl 5.016000, /Users/nick/perl5/per +lbrew/perls/perl-5.16.0/bin/perl ok 2 - Module Hash Input Works ok 3 - Hostname Must be Defined ok 4 - Port Has to be Defined and Integer ok 5 - Got Hash Output ok 6 - Module Hash Keys are Identical ok 7 - Exptected Output From the Module Received ok 8 - Faulty Test Extra Key ok 9 - Correct Output Error Extra Hash Key ok 10 - Faulty Test no Hostname ok 11 - Correct Output Error No Hostname ok 12 - Faulty Test Negative Port Number ok 13 - Correct Output Error for Negative Port Number ok 14 - Faulty Test Out of Range Port Number ok 15 - Correct Output Error Out of Range Port Number 1..15
        and
        [12:51][nick:~/.cpan/build/Net-SNTP-Client-0.01-4Dgp0y]$ make test TES +T_VERBOSE=1 PERL_DL_NONLAZY=1 "/Users/nick/perl5/perlbrew/perls/perl-5.16.0/bin/pe +rl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Ha +rness::Switches; test_harness(1, 'blib/lib', 'blib/arch')" t/*.t t/00-load.t ....... ok 1 - use Net::SNTP::Client; # Testing Net::SNTP::Client 0.01, Perl 5.016000, /Users/nick/perl5/per +lbrew/perls/perl-5.16.0/bin/perl ok 2 - Module Hash Input Works ok 3 - Hostname Must be Defined ok 4 - Port Has to be Defined and Integer ok 5 - Got Hash Output ok 6 - Module Hash Keys are Identical ok 7 - Exptected Output From the Module Received ok 8 - Faulty Test Extra Key ok 9 - Correct Output Error Extra Hash Key ok 10 - Faulty Test no Hostname ok 11 - Correct Output Error No Hostname ok 12 - Faulty Test Negative Port Number ok 13 - Correct Output Error for Negative Port Number ok 14 - Faulty Test Out of Range Port Number ok 15 - Correct Output Error Out of Range Port Number 1..15 ok t/manifest.t ...... 1..0 # SKIP Author tests not required for installation skipped: Author tests not required for installation t/pod-coverage.t .. 1..0 # SKIP Author tests not required for installation skipped: Author tests not required for installation t/pod.t ........... 1..0 # SKIP Author tests not required for installation skipped: Author tests not required for installation All tests successful. Files=4, Tests=15, 1 wallclock secs ( 0.04 usr 0.01 sys + 0.15 cusr + 0.03 csys = 0.23 CPU) Result: PASS
        Remember: Ne dederis in spiritu molere illegitimi!