develooper Front page | perl.perl6.language | Postings from April 2001

Re: Larry's Apocalypse 1

Thread Previous | Thread Next
From:
Johan Vromans
Date:
April 6, 2001 04:03
Subject:
Re: Larry's Apocalypse 1
Message ID:
15053.41578.691639.532005@phoenix.squirrel.nl
Graham Barr <gbarr@pobox.com> writes:

> 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.

Nice. I use

  if ( ! caller ) {
     # selftest
  }

-- Johan

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