Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

nkuitse (193)

nkuitse
  (email not shown publicly)
http://www.nkuitse.com/

Journal of nkuitse (193)

Thursday April 29, 2004
02:01 PM

Debugging *hurts*

[ #18552 ]

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!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.