Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Issues when testing module loading

by moritz (Cardinal)
on Jun 03, 2008 at 15:36 UTC ( #689913=note: print w/ replies, xml ) Need Help??


in reply to Issues when testing module loading

When you test your modules, don't test if the prerequisites work - your Makefile.PL should test if they are available, and their specific test suites should check that they work the way they are expected to.

So just test use_ok 'Your::Module';.

(I know that doesn't answer the underlying question of how to test module loading; if you just want to silence these warnings, use no warnings qw(redefine prototype);)


Comment on Re: Issues when testing module loading
Select or Download Code
Re^2: Issues when testing module loading
by skx (Parson) on Jun 03, 2008 at 15:59 UTC

    Thanks for that reply - yes if I were distributing things using a Makefile.PL then this would be a non-issue. But right now I distribute things as Debian packages, and raw .tar.gz files.

    (This particular case came up when I made a new release of my chronicle blog compiler.)

    Changing my test case to read as follows still fails though:

    #/usr/bin/perl -w # use strict; use warnings; no warnings "all"; use Test::More qw( no_plan ); BEGIN{ use_ok( 'CGI' ); } BEGIN{ use_ok( 'Date::Format' ); } BEGIN{ use_ok( 'POSIX' ); }
    Steve
    --
      my bad, warnings only effects the lexical scope, and the warnings are generated inside the POSIX module.

      One workaround is to explicitly only import a non-conflicting sub BEGIN{ use_ok( 'POSIX', 'setsid' ); }. Or use require_ok, which doesn't import anything.

      Or don't test for POSIX at all, it's been core since perl 5, and not likely to go away any time soon.

        I will stop testing for POSIX, as you suggest. (The test file is automatically generated; but I can add an exception to it without too much difficulty!)

        Steve
        --

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://689913]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (17)
As of 2015-07-02 17:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (44 votes), past polls