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

Michael G Schwern <[email protected]>
Newsgroups gmane.comp.lang.perl.quality-assurance
Message-ID <[email protected]>
On 2012.4.11 8:45 AM, Aristotle Pagaltzis wrote:
> Then you simply do this:
> 
>     use Test::More tests => 1;
>     use Test::AutoBailOut reason => 'Could not load prerequisites';
>     use Config;
> 
>     use Test::Trap::Builder::TempFile;
>     use Test::Trap::Builder::SystemSafe;
>     use Test::Trap::Builder;
>     use Test::Trap;
>     use if $Config{'useperlio'}, 'Test::Trap::Builder::PerlIO';
> 
>     no_bailout 'All prerequisites loaded';
> 
> Dead simple. Huge swathes of complexity, *puff* – vanished.
> 
> Schwern, care to ship that in Test::More to deprecate `use_ok`? :)

Nope, too much magic for too small a use case.  You should make it a module
and talk to Ovid about Test::Most.

Let me reiterate, I have no plans to *deprecate* `use_ok`.  Even if I wanted
to there are simply too many users to make deprecation worth while.

It works fine if what you want is a runtime require + import + assert, and
sometimes you want that.  The problem is it's been overused and has come to
replace a simple `use` in test scripts.  To that end the question is whether
to *discourage* its use in the documentation: to scale it back from "use this
when you load a module" to "use this for some special cases".


-- 
The interface should be as clean as newly fallen snow and its behavior
as explicit as Japanese eel porn.
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.