So my new distribution, Time-AutoRes, just failed a cpansmoke test:
Can't locate object method "export_to_level" via package "Time::HiRes" at /root/.cpanplus/5.8.0/build/Time-AutoRes-0.02/blib/lib/Time/AutoRes.pm line 24.
The current version of Time::HiRes inherits this method from Exporter, so it would seem that I just need to change
use Time::HiRes
to
use Time::HiRes m.n
where
m.n is the earliest version in which Time::HiRes inherited from Exporter.
Unfortunately, Time::HiRes has apparently
always inherited from Exporter. And upon checking the test file in question (note to self: always a good first step), I see that the failing test relies on Time::HiRes
not being found -- it uses Test::Without::Module to mimic a situation in which Time::HiRes is not installed. (That's the whole purpose of Time::AutoRes -- provide access to Time::HiRes::sleep et al. when Time::HiRes is available, and fall back to CORE::sleep et al. when it's not.)
So is the bug in Test::Without::Module, Time::AutoRes, Time::HiRes, or what? I'm confused!
Here's the relevant code from Time::AutoRes:
package Time::AutoRes;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $use_hires);
$VERSION = 0.02;
@ISA = qw(Exporter);
require Exporter;
BEGIN {
eval 'require Time::HiRes';
$use_hires = not $@;
if ($use_hires) {
@EXPORT = @Time::HiRes::EXPORT;
@EXPORT_OK = @Time::HiRes::EXPORT_OK;
} else {
@EXPORT = qw();
@EXPORT_OK = qw(sleep alarm usleep ualarm time);
}
}
sub import {
if ($use_hires) {
Time::HiRes->export_to_level(0, @Time::HiRes::EXPORT_OK);
Time::HiRes->export_to_level(1, @_);
} else {
...
}
...
}
How in the world do I approach fixing this when the test passes on my system (Perl 5.6.0 on Mac OS X)? Levels within levels... My brain hurts!