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,

Alceu Rodrigues de Freitas Junior
---------------------------------
"You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill

In reply to List::BinarySearch and conditional tests with Test::More by glasswalk3r

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.