[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] MacPerl beautifier? (written preferably in Perl?)



I am looking for a perl program that takes a perl program
and formats it to maximise clarity and readability. C programmers
will be familiar with "cb" (C beautifier), and I was thinking it
would be nice to have a program to help format a MacPerl program.

My objective of such a utility is to ident the code so
the opening and closing braces are paired up nicely.
For example:

Before:

1 while (<>) {
2 if (/Fred/)  {
3 $fred = 'Y';
4 } elsif (/Frog/) {
5 $frog = 'Y';
6 }
7 }

After:

1 while (<>) {
2   if (/Fred/)  {
3     $fred = 'Y';
4   } elsif (/Frog/) {
5     $frog = 'Y';
6   }
7}

Correctly formatted code is much easier to understand!

The programming environment I use at the office (Unidata/UniBasic)
has a formatting option to draw vertical lines to show the structure
of If/then/else statements and loop/while/repeat options...useful
for printing but not compiling.  Example:

1 while (<>) {
2 |  if (/Fred/)  {
3 |  | $fred = 'Y';
4 |  } elsif (/Frog/) {
5 |  |  $frog = 'Y';
6 |  }
7 }

I've already started coding such a program, but I'm sure it has
been done already.

Charles


-----------------------------------------------------------------
      Charles Cave                         Sydney, Australia
      Email:                         charles@jolt.mpx.com.au
-------------http://www.ozemail.com.au/~caveman/------------------



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch