in reply to Is it safe/recommended to use pairs of =cut for multi line comments?

There are some other ways to "turn off" sections of code other than using the pod directives. For quickie debugging, I often use a simple: if(0){...} with the expectation that I will remove that once I find the program error. I guess a habit from writing other languages.

For something that I expect to "live" as part of the code, I sometimes do this:

use constant DEBUG => 0; if (DEBUG){ # block is optimized away at compile time .... # but I can turn in "on" again easily } # very readable and effective
I felt pairs of "=cut" is easier to remember than "=pod" or "=begin/end comment"
There is really only one thing to remember, "=cut", ends that section. You don't have to use =pod to start, use anything that you want. I think you have a confusing mess if you use =cut to start a pod block although that does work, despite the documentation to the contrary. For debugging, I guess anything goes, but I believe it unwise to go against the documentation because a someday Perl might actually wind up doing what the documentation says!

Your question is more of "how do I disable code" rather than permanent multi-line textual comments which I think is a different subject.

  • Comment on Re: Is it safe/recommended to use pairs of =cut for multi line comments?
  • Download Code