The implementation of the 'NO_TIME_HIRES' is flawed.  The problem is
that the code for the module is executed (i.e., if (!$NO_TIME_HIRES)
{...}) before the import() function is called.  Would it work to move
the if block inside import():

sub import {
  my $pkg = shift;
  my @sym;
  for my $sym (@_) {
    if ($sym eq 'NO_TIME_HIRES') {
      $NO_TIME_HIRES = 1;
    } else {
      push @sym, $sym;
        print("$sym\n");
    }
  }

  if (!$NO_TIME_HIRES) {
    eval { require Time::HiRes; };
    if ($@ =~ /^Can\'t locate Time/) {
        # OK, just continue
    } elsif ($@) {
        die if $@;
    } else {
        cache_time_api();  # hook in high precision time
    }
  }

  $pkg->export_to_level(1, undef, @sym);
}


=====
Jerry D. Hedden
<< If you're not having fun, then you're not doing it right! >>

Reply via email to