|Do you know where your variables are?|
Acme::Don'tby rob_au (Abbot)
|on May 10, 2002 at 03:16 UTC||Need Help??|
Item Description: The opposite of do
Review Synopsis: Something more than just a gimmick and an interesting use for Perl4 module pragma
This module, from the warped mind of Damian Conway, provides only one export, the don't command. This command is used in exactly the same way as the do BLOCK function except that, instead of executing the block it controls, to quote the module POD, "it...well...doesn't".
The result of wrapping a code block by the don't command is a no-operation which, regardless of the contents of the block, returns undef.
Why review this module? Well, in contrast to many of the other modules which have found their way into the Acme:: namespace, I can actually see a use for this module in development. How many time have you been working on some code and wanted to comment out a section of it to test specific code components? With Acme::Don't, it is as simple as adding the surrounding don't block! The only caveat with this debugging and development approach is that code within the don't block must be syntactically valid, providing compile time-syntax checks without execution. Additionally, it should be recognised that this statement is not all encompassing with BEGIN blocks placed within a don't block still being executed - For example:
The above code still produces the output of "foo" as a result of the BEGIN block execution.
Other caveats of this interesting module are included in the module documentation and while this module resides within in the Acme:: namespace it might just be something more than a gimmick and an interesting use for Perl4 module pragma :-)