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

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

Thread Previous | Thread Next
From:
chromatic
Date:
April 11, 2012 09:46
Subject:
Re: Revert use_ok() change to allow lexical effects?
Message ID:
201204110946.07586.chromatic@wgz.org
On Wednesday, April 11, 2012 at 09:39 AM, Andy Lester wrote:

> In this example:
> 
> BEGIN {
>     use_ok( 'App::Ack' );
>     use_ok( 'App::Ack::Repository' );
>     use_ok( 'App::Ack::Resource' );
>     use_ok( 'File::Next' );
> }
> diag( "Testing App::Ack $App::Ack::VERSION, File::Next $File::Next::VERSION, 
Perl $], $^X" );
> 
> it sounds like we're saying that the use_ok() doesn't help at all, and I 
might as well write
> 
> use App::Ack;
> use App::Ack::Repository;
> use App::Ack::Resource;
> use File::Next;
> diag( "Testing App::Ack $App::Ack::VERSION, File::Next $File::Next::VERSION, 
Perl $], $^X" );
> 
> Agreed?

Exactly. If any of those modules fail to load or compile or import, Perl will 
give you the error at that point and stop the compilation (modulo any die 
handler in effect). You can debug it from there.

-- c

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