in reply to List::BinarySearch and conditional tests with Test::More
Don't call import because that only makes sense at compile-time. Call the binsearch function using its full name, and forcibly ignore its prototype...
SKIP: { eval { require List::BinarySearch } or skip "List::BinarySearch not installed", 2; $index = &List::BinarySearch::binsearch( sub {$a <=> $b}, 300, @num_array, ); # ... }
Alternatively, split the tests which use binsearch into a separate test file, and in that file use:
use Test::Requires "List::BinarySearch";
... which will automatically do the right thing in terms of skipping, importing at compile time, etc.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: List::BinarySearch and conditional tests with Test::More
by davido (Cardinal) on Nov 30, 2014 at 07:01 UTC | |
|
Re^2: List::BinarySearch and conditional tests with Test::More
by glasswalk3r (Friar) on Nov 30, 2014 at 17:40 UTC | |
by tobyink (Canon) on Dec 01, 2014 at 07:51 UTC |