Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: More than One Line Comment

by ff (Hermit)
on Nov 17, 2005 at 15:40 UTC ( [id://509441]=note: print w/replies, xml ) Need Help??


in reply to Re: More than One Line Comment
in thread More than One Line Comment

I'd say "can't indent them" is a feature.

Be definition, we are talking about cases of multiline comments, and such a chunk deserves easily identifiable start/stop markers. On their own lines. And of course everything between the markers gets to stay exactly where it was before you marked it off. Later, if you decide that you can live with those lines running after all (as below), you can put '#' comments in front of your pod markers; don't delete your pod markers because you may change your mind yet again and desire to re-ignore those lines.

#=pod #no warnings 'all'; # doesn't seem to prevent error message +s.... my $xform = new RTF::TEXT::Converter->new( output => \$output_string ); $xform->parse_string( $input_string ); #=cut
But a "good style" rule somewhere says "Don't abuse pod this way!" Well, I don't put my user documentation for the program within the file, I put it in it's own separate pod file, and so the two usages never get mixed up.

I also use the 'if 0' approach to isolate code blocks that I don't want to run. Particularly for code blocks that help me with debugging. By formatting them as follows, i.e. with 'if 1' starting in column 1 when I want a debugging section to fire, I can find those sections easily via vim with '/^if 1' and turn them off by editing to 'if 0'. While I could also use a "$debug" flag, I'd then have to wade through all the other debugging output from the other 'if $debug' sections when I really only want the surgical strike of enabling this particular block. The problem with using 'if 0' to comment out questionable/narrative sections of stuff is that the compiler complains about improper innards even though you don't want any of it to run.

do { # Should be unnecessary to see this; the data is in the dd_config_ +info file my $msg = Dumper( \%ddcon_contents, \@ddcon_order, $dd_con_defaults, ); esdw "ddc_data2 $msg\n"; } if 1;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://509441]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-03-28 22:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found