Take this simple test case:
#!/usr/bin/env perl
use Test::Most;
use Scalar::Util qw( reftype );
ok( 1, 'foo' );
done_testing();
Running this test gives me the following output:
Prototype mismatch: sub main::reftype: none vs ($) at /Users/olaf/perl5/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.2/Exporter.pm line 66.
There are 2 ways I can get rid of this warning.
- I can use Test::More rather than Test::Most
- I can use Test::Most but not explicitly import reftype
I’m ok with calling Scalar::Util::reftype (or even using another module), but I’m looking for a little help in debugging this issue so that I can file the appropriate bug report, since I’m not sure as to where the root cause of the warning lies.
Both
Test::MostandScalar::Utildefine functions calledreftype, and the way you are callingusecauses both modules to try to export theirreftypefunctions to the calling package. Sometimes this will trigger aSubroutine ... redefinedwarning, but in this caseScalar::Util::reftypewants to define itself with a prototype, so the conflict is a more serious error.Some options other than calling
Scalar::Util::reftype($ref):One. to define and use a different alias for
Scalar::Util::reftypeuse Scalar::Util (); BEGIN { *su_reftype = *Scalar::Util::reftype; } print "reftype is ", su_reftype($ref), " ...";Two. Remove
reftypefrom the symbol table before loadingScalar::Util:use Test::Most; BEGIN { *{reftype} = '' } use Scalar::Util 'reftype';