yow!
commentscript
a script to comment/uncomment blocks in perl scripts
save this executable perl script in any folder that is included in PATH, or in ~/bin (which is already there in PATH). (and also make sure it is executable if it somehow doesnt work)
Usage: commentscript perlscriptname
where perlscriptname is the... make a wild guess... yip, the script containing the block that you want commented.
Description:
In any perl script, to comment blocks of code, put a block (a collection of consecutive lines, nothing more) between ## and ## (they should both be at the start of a line), and run this script on it (by passing perlscriptname as a command-line argument).
To uncomment, change both the ##'s to ##! and run this script on perlscriptname again.
Example:
print "hi. ";
##
print "hah.";
print " blah hash";
##
print "hash functions are cool";
changes to
print "hi. ";
##
# print "hah.";
#
# print " blah hash";
##
print "hash functions are cool";
and
print "hi. ";
##!
# print "hah.";
#
# print " blah hash";
##!
print "hash functions are cool";
changes to
print "hi. ";
print "hah.";
print " blah hash";
print "hash functions are cool";
ps - for extra safety, the script also makes a backup copy of the original perlscriptname by the name of perlscriptname.backup in the folder that the script (commentscript) is run from.
psst - comments, bug reports, and additional feature requests are... as ever... most welcome.
No comments:
Post a Comment