Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

 

Acme::Don't

 

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:

use Acme::Don't; don't { BEGIN { print "foo"; } print "bar!\n"; }

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 :-)

 


In reply to Acme::Don't by rob_au

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-16 15:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found