Foo JH wrote:
> Taguchi san,
> 
> I like the coding style below for one main reason: it's easy to comment 
> out if needed.

No easier than any other method - other than it's compressed into
fewer lines - which also makes it less easily modified.

> IMHO good coding style should support the following:
> 1. Easy to read. Puristic styles are a matter of opinion. I prefer to 
> maintain a hybrid concept between K&R, BSD, and none-of-the-above; 
> choosing one where it makes the code easier to understand at first (or 
> second) glance.
> 
> 2. Easy to comment out. Since Perl does not support block comments like 
> C (/* and */), I usually refactor key blocks of codes into functions, so 
> it's easier to deactivate them (eg. for debugging purposes).

There are other ways to block out code in Perl.  Personally, I use
a vim macro and just comment out the block by marking the first line
(type ma [mark 'a' position]) and going to the last line and executing
the macro by hitting the key you have it bound to (I use #).

        :nmap # mz:'a,'zs/^/# /^M               # I add a space in col2 for 
readability

To remove a block, just bind another key to below and type 'ma' at the top
and hit the key (F2 in this case) at the bottom:

        :nmap <F2> mz:'a,'zs/^# \?//^M

But you can also use an if or pod comment syntax:

=for comment    # comment out with pod syntax

... code...

=cut            # close pod comment out


if (0) {        # comment out with an if (has advantage that you can turn back 
on
                # by changing 0 to 1)

... code...

}               # close if comment out




_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to