8/17

3. Automated Layout (Chapter 2)

  • Use perltidy to enforce coding conventions.

  • For example, this:

        $h = shift || exit 1; $cmd = @ARGV ? "ssh -A" : "ssh -At";
        open F, "$ENV{HOME}/.ssh/via_hosts";
        while (<F>) {if (/$h$/) {
        s,^| ,$&$cmd ,g;
        chomp;
        exec ((split), @ARGV)}}
        exec ($cmd, $h, @ARGV)
  • Can become this:

        $h = shift || exit 1;
        $cmd = @ARGV ? "ssh -A" : "ssh -At";
        open F, "$ENV{HOME}/.ssh/via_hosts";
        while (<F>) {
    	if (/$h$/) {
    	    s/^| /$&$cmd /g;
    	    chomp;
    	    exec( (split), @ARGV );
    	}
        }
        exec( $cmd, $h, @ARGV )