Luke Palmer wrote:

> Ooh! Why don't we have a dont command!  With several variants:
>         dont FILE
>         dont BLOCK
> 
> dont { print "Boo" }
> 
> Would print:
>
>

You really *should* be more careful what you wish for Luke.
The following was just uploaded to the CPAN...

Damian


-----cut----------cut----------cut----------cut----------cut----------cut-----

NAME
    Acme::Don't - The opposite of `do'

VERSION
    This document describes version 1.00 of Acme::Don't, released May 1,
    2002.

SYNOPSIS
        use Acme::Don't;

        don't { print "This won't be printed\n" };    # NO-OP

DESCRIPTION
    The Acme::Don't module provides a `don't' command, which is the opposite
    of Perl's built-in `do'.

    It is used exactly like the `do BLOCK' function except that, instead of
    executing the block it controls, it...well...doesn't.

    Regardless of the contents of the block, `don't' returns `undef'.

    You can even write:

        don't {
            # code here
        } while condition();

    And, yes, in strict analogy to the semantics of Perl's magical
    `do...while', the `don't...while' block is *unconditionally* not done
    once before the test. ;-)

    Note that the code in the `don't' block must be syntactically valid
    Perl. This is an important feature: you get the accelerated performance
    of not actually executing the code, without sacrificing the security of
    compile-time syntax checking.

LIMITATIONS
    Doesn't (yet) implement the opposite of `do STRING'. The current
    workaround is to use:

        don't {"filename"};

AUTHOR
    Damian Conway ([EMAIL PROTECTED])

BLAME
    Luke Palmer really should be *far* more careful what he idly wishes for.

BUGS
    Unlikely, since it doesn't actually do anything. However, bug reports
    and other feedback are most welcome.

COPYRIGHT
    Copyright (c) 2002, Damian Conway. All Rights Reserved. This module is
    free software. It may be used, redistributed and/or modified under the
    terms of the Perl Artistic License (see
    http://www.perl.com/perl/misc/Artistic.html)

Reply via email to