glasswalk3r has asked for the wisdom of the Perl Monks concerning the following question:
Greetings monks,
I'm trying to use List::BinarySearch inside a SKIP: block of Test::More to implement conditional tests without success because I'm not being able to import the function binsearch with require.
This is what I'm trying to do:
SKIP: { eval { require List::BinarySearch; List::BinarySearch->import('bin +search') }; skip "List::BinarySearch not installed", 2 if $@; # a bunch of tests }
Looking at the source of List::BinarySearch I found that it does inherits from Export and it is overriding the import (kind of weird because it is using goto instead calling SUPER) but somehow the method call is not working as expected because I'm getting those errors when executing:
Use of uninitialized value $a in string eq at t/010-sysinfo.t line 62. Use of uninitialized value $b in string eq at t/010-sysinfo.t line 62. Can't call method "binsearch" without a package or object reference at + t/010-sysinfo.t line 62.
I also tried using "List::BinarySearch::binsearch" but it just produce more errors:
Use of uninitialized value $a in string eq at t/010-sysinfo.t line 60. Use of uninitialized value $b in string eq at t/010-sysinfo.t line 60. Can't call method "List::BinarySearch::binsearch" without a package or + object reference at t/010-sysinfo.t line 60.
Am I missing something here, or should I contact the module author? :-)
Thanks,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: List::BinarySearch and conditional tests with Test::More
by tobyink (Canon) on Nov 30, 2014 at 01:23 UTC | |
by davido (Cardinal) on Nov 30, 2014 at 07:01 UTC | |
by glasswalk3r (Friar) on Nov 30, 2014 at 17:40 UTC | |
by tobyink (Canon) on Dec 01, 2014 at 07:51 UTC | |
|
Re: List::BinarySearch and conditional tests with Test::More
by davido (Cardinal) on Nov 30, 2014 at 07:10 UTC | |
by glasswalk3r (Friar) on Nov 30, 2014 at 17:42 UTC | |
by davido (Cardinal) on Dec 01, 2014 at 16:58 UTC |