develooper Front page | perl.perl5.porters | Postings from March 2011

Re: [perl #87064] Semi-Semicolons test suite is broken since perl5.13.7

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
March 30, 2011 07:20
Subject:
Re: [perl #87064] Semi-Semicolons test suite is broken since perl5.13.7
Message ID:
20110330142045.GQ2900@iabyn.com
On Tue, Mar 29, 2011 at 12:16:33PM +0100, Zefram wrote:
> So I reckon use_ok is seriously broken, and the core change has just
> made this brokenness show up in a new situation.  use_ok needs to do the
> require and import itself, without any string eval.  The core of it is
> something like:
> 
> 	sub my_use($;@) {
> 		my $module = $_[0];
> 		(my $filename = $module.".pm") =~ s!::!/!g;
> 		require($filename);
> 		goto &{$module->can("import")};
> 	}


But of course, if does the goto (to get the correct caller lexical scope),
then it's too late to print 'not ok' if the import fails (e.g. if it dies).

So I suspect that use_ok() is fundamentally unsuitable (and not fixable)
for modules that affect the callers lexical scope.

In which case, it's probably best to just document this limitation in
Test::More, and suggest to Semi-Semicolons's maintainer to avoid
use_ok().

If this is acceptable, then this ticket ceases to be a 5.14 blocker.

-- 
Lear: Dost thou call me fool, boy?
Fool: All thy other titles thou hast given away; that thou wast born with.

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