develooper Front page | perl.qa | Postings from April 2012

Re: Revert use_ok() change to allow lexical effects?

Thread Previous | Thread Next
From:
Eirik Berg Hanssen
Date:
April 12, 2012 01:36
Subject:
Re: Revert use_ok() change to allow lexical effects?
Message ID:
CAHAeAG7F96Rcz6qvxZJjzpD22d6VQHZDgcY_TaYYjNoN-SEwhw@mail.gmail.com
On Wed, Apr 11, 2012 at 6:32 PM, Michael G Schwern <schwern@pobox.com>wrote:

> On 2012.4.10 6:21 PM, The Sidhekin wrote:
> > * How would you rewrite a test script such as my own
> > http://cpansearch.perl.org/src/EBHANSSEN/Test-Trap-v0.2.2/t/00-load.t so
> > that it does not use use_ok()?
>
>   use Test::More tests => 1;
>
>   use Test::Trap::Builder::TempFile;
>

*cut*

  If this fails, the test script will terminate immediately:

* I won't get to know if any of the other modules loaded correctly, or how
they fail.  Less of the interesting output.
* And there will be no BAIL_OUT, so the rest of the tests will run, burying
the interesting output.  More uninteresting output.

  Which are two very annoying changes in your rewrite.  And of course,
there's more of the same in the part of the rewrite I cut.




> * Why would you? :-\
>
> Because it reads like normal Perl and doesn't rely on more code to do
> something rather simple: load a module.
>

  But it fails to DWIW: report clearly on failures.  Perhaps what it is
doing is not so simple, after all?



> But quite honestly, if use_ok() works for you, if all you need is require +
> import + test, continue to use it.  I don't plan on eliminating it.
>

  Thank you.


Eirik


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About