http://qs321.pair.com?node_id=143785


in reply to (OT) Editor-neutral code formatting

Ovid,

++ to you for saving my sanity. That's just about exactly the format I use to code. I don't think I've ever seen anyone format quite like I do.

The only thing I do differently is to keep the braces in-line with the block that surrounds them (indenting them all) like so:


sub_connect 
       {
       my %conn_data  = @_;
       my $dbh = DBI->connect(
                $conn_data{ data_source }, 
                $conn_data{ user }, 
                $conn_data{ pass },
                        {
                        RaiseError  => 1,
                        AutoCommit  => 0,
                        LongReadLen => 65_634
                        } 
                ) or die DBI->errstr;
        $dbh;
        }

I like the way this quickly delineates function definitions and gives the reader a bird's eye view of the major chunks of code.

Cheers!

Brent

  • Comment on Re: (OT) Editor-neutral code formatting