Re: require|use_ok() and ensure_blib() boilerplate

Eric Wilhelm <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.module-build
Message-ID <[email protected]>
# from David Golden
# on Friday 28 August 2009 03:31:

>* ensure_blib doesn't sound like a test function even though it is.
>That's a nit, but could confuse someone trying to count tests.  That
>could be fixed with a big find/replace commit, but I just haven't
>gotten around to it.

I think we could drop both that and the require_ok('Module::Build') 
boilerplate if MBTest would:

  use Module::Build;
  BEGIN {
    unless($ENV{PERL_CORE}) {
      unless($INC{"Module/Build.pm"} =~ m/\bblib\b/) {
        die 'should have been loaded from blib - @INC contains: ',
          join("\n  ", @INC);
      }
    }
  }

Or something like that.  It's not really a test, and if the check fails 
we should just stop because everything has gone pear-shaped.

Of course, not every ensure_blib() call has the 
argument 'Module::Build' - see moduleinfo.t.  But it hardly seems worth 
having those two lines everywhere when one or zero would do.

Perhaps:

  mbload('Module::Build');

  mbload('Module::Build::YAML');

Thoughts?

--Eric
-- 
Like a lot of people, I was mathematically abused as a child.
--Paul Graham
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.