Learned monks,

I am working on a test script:

#!/usr/bin/perl use strict; use warnings; use Test::More; my @compressors = qw/ Foo::Bar Compress::Snappy Compress::LZ4 /; for my $compressor ( @compressors ) { note " Testing with $compressor"; if ( ! eval "use $compressor; 1;" ) { note " Cannot load $compressor - skipping tests"; next; } note " Ready"; }
Output:
# Testing with Foo::Bar # Cannot load Foo::Bar - skipping tests # Testing with Compress::Snappy # Ready # Testing with Compress::LZ4 Prototype mismatch: sub main::compress ($) vs ($;$) at /perl5/perlbrew +/perls/perl-5.22.1/lib/5.22.1/Exporter.pm line 66. at (eval 8) line 1. Prototype mismatch: sub main::decompress ($) vs ($;$) at /perl5/perlbr +ew/perls/perl-5.22.1/lib/5.22.1/Exporter.pm line 66. at (eval 8) line 1. Prototype mismatch: sub main::uncompress ($) vs ($;$) at /perl5/perlbr +ew/perls/perl-5.22.1/lib/5.22.1/Exporter.pm line 66. at (eval 8) line 1. # Ready

I understand why the warning is printed (the two modules have identical APIs), and I know I could work around it by making separate test files, but that's not desirable. Also, it's just a warning and the subs work fine when the second module is loaded, but the warnings are undesirable.

I have searched but not found a way to clear the symbol table so the second time through the loop the subs can be imported without the warning. I can't use any non-core modules for the solution. Any help greatly appreciated!

The way forward always starts with a minimal test.

In reply to Resolving 'prototype mismatch' warning by 1nickt

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.