1nickt has asked for the wisdom of the Perl Monks concerning the following question:
Learned monks,
I am working on a test script:
Output:#!/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"; }
# 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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Resolving 'prototype mismatch' warning
by jdporter (Paladin) on Feb 15, 2016 at 06:51 UTC | |
by Corion (Patriarch) on Feb 15, 2016 at 14:22 UTC | |
by 1nickt (Canon) on Feb 15, 2016 at 14:36 UTC | |
|
Re: Resolving 'prototype mismatch' warning
by LanX (Saint) on Feb 15, 2016 at 03:51 UTC |