On Thu, Apr 05, 2001 at 10:10:47PM +0100, Michael G Schwern wrote: > > Then it might be easier to write modules that are testable without a test > > driver. If you run the module directly, some distinguished block of code > > could be executed that wouldn't be if the module were "included" via > > "require" or "use" (or similar replacement constructs). > > See also SelfTest.pm I have not looked at SelfTest, but I have always done this with unless (defined wantarray) { # Self Test } This works because whenever a file is use'd, require'd etc. it is evaluated in a scalar context. The main file is in a void context. Graham.
- Re: Parsing perl 5 with perl 6 (... Edward Peschko
- Re: Parsing perl 5 with perl 6 (... Dan Sugalski
- Re: Parsing perl 5 with perl 6 (... Larry Wall
- Re: Parsing perl 5 with perl 6 (... Ask Bjoern Hansen
- Re: Parsing perl 5 with perl 6 (... Jonathan Scott Duff
- Re: Larry's Apocalypse 1 John Porter
- Re: Larry's Apocalypse 1 James Mastros
- Re: Larry's Apocalypse 1 Andy Dougherty
- Re: Larry's Apocalypse 1 Nathan Torkington
- Re: Larry's Apocalypse 1 Simon Cozens
- Re: Larry's Apocalypse 1 Graham Barr
- Re: Larry's Apocalypse 1 Johan Vromans
- Re: Larry's Apocalypse 1 Paul Johnson
- Re: Larry's Apocalypse 1 Graham Barr
- Re: Larry's Apocalypse 1 Simon Cozens
- Re: Larry's Apocalypse 1 Graham Barr
- Re: Larry's Apocalypse 1 Simon Cozens
- Re: Larry's Apocalypse 1 Jarkko Hietaniemi
- Re: Larry's Apocalypse 1 Nathan Torkington
- Re: Larry's Apocalypse 1 John Porter
- Re: Larry's Apocalypse 1 Randal L. Schwartz