File: perltidy

package info (click to toggle)
perltidy 20200110-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,624 kB
  • sloc: perl: 23,636; makefile: 4
file content (3865 lines) | stat: -rwxr-xr-x 148,475 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
#!/usr/bin/perl
package main;

use Perl::Tidy;

my $arg_string = undef;

# give Macs a chance to provide command line parameters
if ( $^O =~ /Mac/ ) {
    $arg_string = MacPerl::Ask(
        'Please enter @ARGV (-h for help)',
        defined $ARGV[0] ? "\"$ARGV[0]\"" : ""
    );
}

# Exit codes returned by perltidy:
#    0 = no errors
#    1 = perltidy could not run to completion due to errors
#    2 = perltidy ran to completion with error messages
exit Perl::Tidy::perltidy( argv => $arg_string );

__END__

=head1 NAME

perltidy - a perl script indenter and reformatter

=head1 SYNOPSIS

    perltidy [ options ] file1 file2 file3 ...
            (output goes to file1.tdy, file2.tdy, file3.tdy, ...)
    perltidy [ options ] file1 -o outfile
    perltidy [ options ] file1 -st >outfile
    perltidy [ options ] <infile >outfile

=head1 DESCRIPTION

Perltidy reads a perl script and writes an indented, reformatted script.

Many users will find enough information in L<"EXAMPLES"> to get 
started.  New users may benefit from the short tutorial 
which can be found at
http://perltidy.sourceforge.net/tutorial.html

A convenient aid to systematically defining a set of style parameters
can be found at
http://perltidy.sourceforge.net/stylekey.html

Perltidy can produce output on either of two modes, depending on the
existence of an B<-html> flag.  Without this flag, the output is passed
through a formatter.  The default formatting tries to follow the
recommendations in perlstyle(1), but it can be controlled in detail with
numerous input parameters, which are described in L<"FORMATTING
OPTIONS">.  

When the B<-html> flag is given, the output is passed through an HTML
formatter which is described in L<"HTML OPTIONS">.  

=head1 EXAMPLES

  perltidy somefile.pl

This will produce a file F<somefile.pl.tdy> containing the script reformatted
using the default options, which approximate the style suggested in 
perlstyle(1).  The source file F<somefile.pl> is unchanged.

  perltidy *.pl

Execute perltidy on all F<.pl> files in the current directory with the
default options.  The output will be in files with an appended F<.tdy>
extension.  For any file with an error, there will be a file with extension
F<.ERR>.

  perltidy -b file1.pl file2.pl

Modify F<file1.pl> and F<file2.pl> in place, and backup the originals to
F<file1.pl.bak> and F<file2.pl.bak>.  If F<file1.pl.bak> and/or F<file2.pl.bak>
already exist, they will be overwritten.

  perltidy -b -bext='/' file1.pl file2.pl

Same as the previous example except that the backup files F<file1.pl.bak> and F<file2.pl.bak> will be deleted if there are no errors.

  perltidy -gnu somefile.pl

Execute perltidy on file F<somefile.pl> with a style which approximates the
GNU Coding Standards for C programs.  The output will be F<somefile.pl.tdy>.

  perltidy -i=3 somefile.pl

Execute perltidy on file F<somefile.pl>, with 3 columns for each level of
indentation (B<-i=3>) instead of the default 4 columns.  There will not be any
tabs in the reformatted script, except for any which already exist in comments,
pod documents, quotes, and here documents.  Output will be F<somefile.pl.tdy>. 

  perltidy -i=3 -et=8 somefile.pl

Same as the previous example, except that leading whitespace will
be entabbed with one tab character per 8 spaces.

  perltidy -ce -l=72 somefile.pl

Execute perltidy on file F<somefile.pl> with all defaults except use "cuddled
elses" (B<-ce>) and a maximum line length of 72 columns (B<-l=72>) instead of
the default 80 columns.  

  perltidy -g somefile.pl

Execute perltidy on file F<somefile.pl> and save a log file F<somefile.pl.LOG>
which shows the nesting of braces, parentheses, and square brackets at
the start of every line.

  perltidy -html somefile.pl

This will produce a file F<somefile.pl.html> containing the script with
html markup.  The output file will contain an embedded style sheet in
the <HEAD> section which may be edited to change the appearance.

  perltidy -html -css=mystyle.css somefile.pl

This will produce a file F<somefile.pl.html> containing the script with
html markup.  This output file will contain a link to a separate style
sheet file F<mystyle.css>.  If the file F<mystyle.css> does not exist,
it will be created.  If it exists, it will not be overwritten.

  perltidy -html -pre somefile.pl

Write an html snippet with only the PRE section to F<somefile.pl.html>.
This is useful when code snippets are being formatted for inclusion in a
larger web page.  No style sheet will be written in this case.  

  perltidy -html -ss >mystyle.css

Write a style sheet to F<mystyle.css> and exit.

  perltidy -html -frm mymodule.pm

Write html with a frame holding a table of contents and the source code.  The
output files will be F<mymodule.pm.html> (the frame), F<mymodule.pm.toc.html>
(the table of contents), and F<mymodule.pm.src.html> (the source code).

=head1 OPTIONS - OVERVIEW

The entire command line is scanned for options, and they are processed
before any files are processed.  As a result, it does not matter
whether flags are before or after any filenames.  However, the relative
order of parameters is important, with later parameters overriding the
values of earlier parameters.  

For each parameter, there is a long name and a short name.  The short
names are convenient for keyboard input, while the long names are
self-documenting and therefore useful in scripts.  It is customary to
use two leading dashes for long names, but one may be used.

Most parameters which serve as on/off flags can be negated with a
leading "n" (for the short name) or a leading "no" or "no-" (for the
long name).  For example, the flag to outdent long quotes is B<-olq>
or B<--outdent-long-quotes>.  The flag to skip this is B<-nolq>
or B<--nooutdent-long-quotes> or B<--no-outdent-long-quotes>.

Options may not be bundled together.  In other words, options B<-q> and
B<-g> may NOT be entered as B<-qg>.

Option names may be terminated early as long as they are uniquely identified.
For example, instead of B<--dump-token-types>, it would be sufficient to enter
B<--dump-tok>, or even B<--dump-t>, to uniquely identify this command.

=head2 I/O control

The following parameters concern the files which are read and written.

=over 4

=item B<-h>,    B<--help> 

Show summary of usage and exit.

=item	B<-o>=filename,    B<--outfile>=filename  

Name of the output file (only if a single input file is being
processed).  If no output file is specified, and output is not
redirected to the standard output (see B<-st>), the output will go to
F<filename.tdy>. [Note: - does not redirect to standard output. Use
B<-st> instead.]

=item	B<-st>,    B<--standard-output>

Perltidy must be able to operate on an arbitrarily large number of files
in a single run, with each output being directed to a different output
file.  Obviously this would conflict with outputting to the single
standard output device, so a special flag, B<-st>, is required to
request outputting to the standard output.  For example,

  perltidy somefile.pl -st >somefile.new.pl

This option may only be used if there is just a single input file.  
The default is B<-nst> or B<--nostandard-output>.

=item	B<-se>,    B<--standard-error-output>

If perltidy detects an error when processing file F<somefile.pl>, its
default behavior is to write error messages to file F<somefile.pl.ERR>.
Use B<-se> to cause all error messages to be sent to the standard error
output stream instead.  This directive may be negated with B<-nse>.
Thus, you may place B<-se> in a F<.perltidyrc> and override it when
desired with B<-nse> on the command line.

=item	B<-oext>=ext,    B<--output-file-extension>=ext  

Change the extension of the output file to be F<ext> instead of the
default F<tdy> (or F<html> in case the -B<-html> option is used).
See L<Specifying File Extensions>.

=item	B<-opath>=path,    B<--output-path>=path  

When perltidy creates a filename for an output file, by default it merely
appends an extension to the path and basename of the input file.  This
parameter causes the path to be changed to F<path> instead.

The path should end in a valid path separator character, but perltidy will try
to add one if it is missing.

For example
 
 perltidy somefile.pl -opath=/tmp/

will produce F</tmp/somefile.pl.tdy>.  Otherwise, F<somefile.pl.tdy> will
appear in whatever directory contains F<somefile.pl>.

If the path contains spaces, it should be placed in quotes.

This parameter will be ignored if output is being directed to standard output,
or if it is being specified explicitly with the B<-o=s> parameter.

=item	B<-b>,    B<--backup-and-modify-in-place>

Modify the input file or files in-place and save the original with the
extension F<.bak>.  Any existing F<.bak> file will be deleted.  See next
item for changing the default backup extension, and for eliminating the
backup file altogether.  

A B<-b> flag will be ignored if input is from standard input or goes to
standard output, or if the B<-html> flag is set.  

In particular, if you want to use both the B<-b> flag and the B<-pbp>
(--perl-best-practices) flag, then you must put a B<-nst> flag after the
B<-pbp> flag because it contains a B<-st> flag as one of its components,
which means that output will go to the standard output stream.

=item	B<-bext>=ext,    B<--backup-file-extension>=ext  

This parameter serves two purposes: (1) to change the extension of the backup
file to be something other than the default F<.bak>, and (2) to indicate
that no backup file should be saved.

To change the default extension to something other than F<.bak> see
L<Specifying File Extensions>.

A backup file of the source is always written, but you can request that it
be deleted at the end of processing if there were no errors.  This is risky
unless the source code is being maintained with a source code control
system.  

To indicate that the backup should be deleted include one forward slash,
B</>, in the extension.  If any text remains after the slash is removed
it will be used to define the backup file extension (which is always
created and only deleted if there were no errors).

Here are some examples:

  Parameter           Extension          Backup File Treatment
  <-bext=bak>         F<.bak>            Keep (same as the default behavior)
  <-bext='/'>         F<.bak>            Delete if no errors
  <-bext='/backup'>   F<.backup>         Delete if no errors
  <-bext='original/'> F<.original>       Delete if no errors

=item B<-w>,    B<--warning-output>             

Setting B<-w> causes any non-critical warning
messages to be reported as errors.  These include messages
about possible pod problems, possibly bad starting indentation level,
and cautions about indirect object usage.  The default, B<-nw> or
B<--nowarning-output>, is not to include these warnings.

=item B<-q>,    B<--quiet>             

Deactivate error messages and syntax checking (for running under
an editor). 

For example, if you use a vi-style editor, such as vim, you may execute
perltidy as a filter from within the editor using something like

 :n1,n2!perltidy -q

where C<n1,n2> represents the selected text.  Without the B<-q> flag,
any error message may mess up your screen, so be prepared to use your
"undo" key.

=item B<-log>,    B<--logfile>           

Save the F<.LOG> file, which has many useful diagnostics.  Perltidy always
creates a F<.LOG> file, but by default it is deleted unless a program bug is
suspected.  Setting the B<-log> flag forces the log file to be saved.

=item B<-g=n>, B<--logfile-gap=n>

Set maximum interval between input code lines in the logfile.  This purpose of
this flag is to assist in debugging nesting errors.  The value of C<n> is
optional.  If you set the flag B<-g> without the value of C<n>, it will be
taken to be 1, meaning that every line will be written to the log file.  This
can be helpful if you are looking for a brace, paren, or bracket nesting error. 

Setting B<-g> also causes the logfile to be saved, so it is not necessary to
also include B<-log>. 

If no B<-g> flag is given, a value of 50 will be used, meaning that at least
every 50th line will be recorded in the logfile.  This helps prevent
excessively long log files.  

Setting a negative value of C<n> is the same as not setting B<-g> at all.

=item B<-npro>  B<--noprofile>    

Ignore any F<.perltidyrc> command file.  Normally, perltidy looks first in
your current directory for a F<.perltidyrc> file of parameters.  (The format
is described below).  If it finds one, it applies those options to the
initial default values, and then it applies any that have been defined
on the command line.  If no F<.perltidyrc> file is found, it looks for one
in your home directory.

If you set the B<-npro> flag, perltidy will not look for this file.

=item B<-pro=filename> or  B<--profile=filename>    

To simplify testing and switching .perltidyrc files, this command may be
used to specify a configuration file which will override the default
name of .perltidyrc.  There must not be a space on either side of the
'=' sign.  For example, the line

   perltidy -pro=testcfg

would cause file F<testcfg> to be used instead of the 
default F<.perltidyrc>.

A pathname begins with three dots, e.g. ".../.perltidyrc", indicates that
the file should be searched for starting in the current directory and
working upwards. This makes it easier to have multiple projects each with
their own .perltidyrc in their root directories.

=item B<-opt>,   B<--show-options>      

Write a list of all options used to the F<.LOG> file.  
Please see B<--dump-options> for a simpler way to do this.

=item B<-f>,   B<--force-read-binary>      

Force perltidy to process binary files.  To avoid producing excessive
error messages, perltidy skips files identified by the system as non-text.
However, valid perl scripts containing binary data may sometimes be identified
as non-text, and this flag forces perltidy to process them.

=item B<-ast>,   B<--assert-tidy>      

This flag asserts that the input and output code streams are identical, or in
other words that the input code is already 'tidy' according to the formatting
parameters.  If this is not the case, an error message noting this is produced.
This error message will cause the process to return a non-zero exit code.
The test for this is made by comparing an MD5 hash value for the input and
output code streams. This flag has no other effect on the functioning of
perltidy.  This might be useful for certain code maintenance operations.

=item B<-asu>,   B<--assert-untidy>      

This flag asserts that the input and output code streams are different, or in
other words that the input code is 'untidy' according to the formatting
parameters.  If this is not the case, an error message noting this is produced.
This flag has no other effect on the functioning of perltidy.

=item B<-sal=s>,   B<--sub-alias-list=s>      

This flag causes one or more words to be treated the same as if they were the keyword 'sub'.  The string B<s> contains one or more alias words, separated by spaces or commas.

For example,

        perltidy -sal='method fun _sub M4' 

will cause the perltidy to treate the words 'method', 'fun', '_sub' and 'M4' to be treated the same as if they were 'sub'.  Note that if the alias words are separated by spaces then the string of words should be placed in quotes.


=back

=head1 FORMATTING OPTIONS

=head2 Basic Options

=over 4

=item B<--notidy>

This flag disables all formatting and causes the input to be copied unchanged
to the output except for possible changes in line ending characters and any
pre- and post-filters.  This can be useful in conjunction with a hierarchical
set of F<.perltidyrc> files to avoid unwanted code tidying.  See also
L<Skipping Selected Sections of Code> for a way to avoid tidying specific
sections of code.

=item B<-i=n>,  B<--indent-columns=n>  

Use n columns per indentation level (default n=4).

=item B<-l=n>, B<--maximum-line-length=n>

The default maximum line length is n=80 characters.  Perltidy will try
to find line break points to keep lines below this length. However, long
quotes and side comments may cause lines to exceed this length. 
Setting B<-l=0> is equivalent to setting B<-l=(a large number)>. 

=item B<-vmll>, B<--variable-maximum-line-length>

A problem arises using a fixed maximum line length with very deeply nested code
and data structures because eventually the amount of leading whitespace used
for indicating indentation takes up most or all of the available line width,
leaving little or no space for the actual code or data.  One solution is to use
a vary long line length.  Another solution is to use the B<-vmll> flag, which
basically tells perltidy to ignore leading whitespace when measuring the line
length.  

To be precise, when the B<-vmll> parameter is set, the maximum line length of a
line of code will be M+L*I, where

      M is the value of --maximum-line-length=M (-l=M), default 80,
      I is the value of --indent-columns=I (-i=I), default 4,
      L is the indentation level of the line of code

When this flag is set, the choice of breakpoints for a block of code should be
essentially independent of its nesting depth.  However, the absolute line
lengths, including leading whitespace, can still be arbitrarily large.  This
problem can be avoided by including the next parameter.  

The default is not to do this (B<-nvmll>).

=item B<-wc=n>, B<--whitespace-cycle=n>

This flag also addresses problems with very deeply nested code and data
structures.  When the nesting depth exceeds the value B<n> the leading
whitespace will be reduced and start at a depth of 1 again.  The result is that
blocks of code will shift back to the left rather than moving arbitrarily far
to the right.  This occurs cyclically to any depth.  

For example if one level of indentation equals 4 spaces (B<-i=4>, the default),
and one uses B<-wc=15>, then if the leading whitespace on a line exceeds about
4*15=60 spaces it will be reduced back to 4*1=4 spaces and continue increasing
from there.  If the whitespace never exceeds this limit the formatting remains
unchanged.

The combination of B<-vmll> and B<-wc=n> provides a solution to the problem of
displaying arbitrarily deep data structures and code in a finite window,
although B<-wc=n> may of course be used without B<-vmll>.

The default is not to use this, which can also be indicated using B<-wc=0>.

=item tabs

Using tab characters will almost certainly lead to future portability
and maintenance problems, so the default and recommendation is not to
use them.  For those who prefer tabs, however, there are two different
options.  

Except for possibly introducing tab indentation characters, as outlined
below, perltidy does not introduce any tab characters into your file,
and it removes any tabs from the code (unless requested not to do so
with B<-fws>).  If you have any tabs in your comments, quotes, or
here-documents, they will remain.

=over 4

=item B<-et=n>,   B<--entab-leading-whitespace>

This flag causes each B<n> initial space characters to be replaced by
one tab character.  Note that the integer B<n> is completely independent
of the integer specified for indentation parameter, B<-i=n>.

=item B<-t>,   B<--tabs>

This flag causes one leading tab character to be inserted for each level
of indentation.  Certain other features are incompatible with this
option, and if these options are also given, then a warning message will
be issued and this flag will be unset.  One example is the B<-lp>
option.

=item B<-dt=n>,   B<--default-tabsize=n>

If the first line of code passed to perltidy contains leading tabs but no
tab scheme is specified for the output stream then perltidy must guess how many
spaces correspond to each leading tab.  This number of spaces B<n>
corresponding to each leading tab of the input stream may be specified with
B<-dt=n>.  The default is B<n=8>.  

This flag has no effect if a tab scheme is specified for the output stream,
because then the input stream is assumed to use the same tab scheme and
indentation spaces as for the output stream (any other assumption would lead to
unstable editing).

=back

=item B<-syn>,   B<--check-syntax>      

This flag is now ignored for safety, but the following documentation
has been retained for reference.

This flag causes perltidy to run C<perl -c -T> to check syntax of input
and output.  (To change the flags passed to perl, see the next
item, B<-pscf>).  The results are written to the F<.LOG> file, which
will be saved if an error is detected in the output script.  The output
script is not checked if the input script has a syntax error.  Perltidy
does its own checking, but this option employs perl to get a "second
opinion".

If perl reports errors in the input file, they will not be reported in
the error output unless the B<--warning-output> flag is given. 

The default is B<NOT> to do this type of syntax checking (although
perltidy will still do as much self-checking as possible).  The reason
is that it causes all code in BEGIN blocks to be executed, for all
modules being used, and this opens the door to security issues and
infinite loops when running perltidy.

=item B<-pscf=s>, B<-perl-syntax-check-flags=s>

When perl is invoked to check syntax, the normal flags are C<-c -T>.  In
addition, if the B<-x> flag is given to perltidy, then perl will also be
passed a B<-x> flag.  It should not normally be necessary to change
these flags, but it can be done with the B<-pscf=s> flag.  For example,
if the taint flag, C<-T>, is not wanted, the flag could be set to be just
B<-pscf=-c>.  

Perltidy will pass your string to perl with the exception that it will
add a B<-c> and B<-x> if appropriate.  The F<.LOG> file will show
exactly what flags were passed to perl.

=item B<-xs>,   B<--extended-syntax>      

A problem with formatting Perl code is that some modules can introduce new
syntax.  This flag allows perltidy to handle certain common extensions
to the standard syntax without complaint.  

For example, without this flag a structure such as the following would generate
a syntax error and the braces would not be balanced:

    method deposit( Num $amount) {
        $self->balance( $self->balance + $amount );
    }

This flag is enabled by default but it can be deactivated with B<-nxs>.
Probably the only reason to deactivate this flag is to generate more diagnostic
messages when debugging a script.


=item B<-io>,   B<--indent-only>       

This flag is used to deactivate all whitespace and line break changes
within non-blank lines of code.
When it is in effect, the only change to the script will be
to the indentation and to the number of blank lines.
And any flags controlling whitespace and newlines will be ignored.  You
might want to use this if you are perfectly happy with your whitespace
and line breaks, and merely want perltidy to handle the indentation.
(This also speeds up perltidy by well over a factor of two, so it might be
useful when perltidy is merely being used to help find a brace error in
a large script).

Setting this flag is equivalent to setting B<--freeze-newlines> and
B<--freeze-whitespace>.  

If you also want to keep your existing blank lines exactly
as they are, you can add B<--freeze-blank-lines>. 

With this option perltidy is still free to modify the indenting (and
outdenting) of code and comments as it normally would.  If you also want to
prevent long comment lines from being outdented, you can add either B<-noll> or
B<-l=0>.

Setting this flag will prevent perltidy from doing any special operations on
closing side comments.  You may still delete all side comments however when
this flag is in effect.


=item B<-enc=s>,  B<--character-encoding=s>

where B<s>=B<none> or B<utf8>.  This flag tells perltidy the character encoding
of both the input and output character streams.  The value B<utf8> causes the
stream to be read and written as UTF-8.  The value B<none> causes the stream to
be processed without special encoding assumptions.  At present there is no
automatic detection of character encoding (even if there is a C<'use utf8'>
statement in your code) so this flag must be set for streams encoded in UTF-8.
Incorrectly setting this parameter can cause data corruption, so please
carefully check the output.

The default is B<none>.  

The abbreviations B<-utf8> or B<-UTF8> are equivalent to B<-enc=utf8>.
So to process a file named B<file.pl> which is encoded in UTF-8 you can use:

   perltidy -utf8 file.pl

=item B<-ole=s>,  B<--output-line-ending=s>

where s=C<win>, C<dos>, C<unix>, or C<mac>.  This flag tells perltidy
to output line endings for a specific system.  Normally,
perltidy writes files with the line separator character of the host
system.  The C<win> and C<dos> flags have an identical result.

=item B<-ple>,  B<--preserve-line-endings>

This flag tells perltidy to write its output files with the same line
endings as the input file, if possible.  It should work for
B<dos>, B<unix>, and B<mac> line endings.  It will only work if perltidy
input comes from a filename (rather than stdin, for example).  If
perltidy has trouble determining the input file line ending, it will
revert to the default behavior of using the line ending of the host system.

=item B<-it=n>,   B<--iterations=n>

This flag causes perltidy to do B<n> complete iterations.  The reason for this
flag is that code beautification is an iterative process and in some
cases the output from perltidy can be different if it is applied a second time.
For most purposes the default of B<n=1> should be satisfactory.  However B<n=2>
can be useful when a major style change is being made, or when code is being
beautified on check-in to a source code control system.  It has been found to
be extremely rare for the output to change after 2 iterations.  If a value
B<n> is greater than 2 is input then a convergence test will be used to stop
the iterations as soon as possible, almost always after 2 iterations.  See
the next item for a simplified iteration control.

This flag has no effect when perltidy is used to generate html.

=item B<-conv>,   B<--converge>

This flag is equivalent to B<-it=4> and is included to simplify iteration
control.  For all practical purposes one either does or does not want to be
sure that the output is converged, and there is no penalty to using a large
iteration limit since perltidy will check for convergence and stop iterating as
soon as possible.  The default is B<-nconv> (no convergence check).  Using
B<-conv> will approximately double run time since normally one extra iteration
is required to verify convergence.

=back

=head2 Code Indentation Control

=over 4

=item B<-ci=n>, B<--continuation-indentation=n>

Continuation indentation is extra indentation spaces applied when
a long line is broken.  The default is n=2, illustrated here:

 my $level =   # -ci=2      
   ( $max_index_to_go >= 0 ) ? $levels_to_go[0] : $last_output_level;

The same example, with n=0, is a little harder to read:

 my $level =   # -ci=0    
 ( $max_index_to_go >= 0 ) ? $levels_to_go[0] : $last_output_level;

The value given to B<-ci> is also used by some commands when a small
space is required.  Examples are commands for outdenting labels,
B<-ola>, and control keywords, B<-okw>.  

When default values are not used, it is suggested that the value B<n>
given with B<-ci=n> be no more than about one-half of the number of
spaces assigned to a full indentation level on the B<-i=n> command.

=item B<-sil=n> B<--starting-indentation-level=n>   

By default, perltidy examines the input file and tries to determine the
starting indentation level.  While it is often zero, it may not be
zero for a code snippet being sent from an editing session.  

To guess the starting indentation level perltidy simply assumes that
indentation scheme used to create the code snippet is the same as is being used
for the current perltidy process.  This is the only sensible guess that can be
made.  It should be correct if this is true, but otherwise it probably won't.
For example, if the input script was written with -i=2 and the current peltidy
flags have -i=4, the wrong initial indentation will be guessed for a code
snippet which has non-zero initial indentation. Likewise, if an entabbing
scheme is used in the input script and not in the current process then the
guessed indentation will be wrong.

If the default method does not work correctly, or you want to change the
starting level, use B<-sil=n>, to force the starting level to be n.

=item List indentation using B<-lp>, B<--line-up-parentheses>

By default, perltidy indents lists with 4 spaces, or whatever value
is specified with B<-i=n>.  Here is a small list formatted in this way:

    # perltidy (default)
    @month_of_year = (
        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
        'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
    );

Use the B<-lp> flag to add extra indentation to cause the data to begin
past the opening parentheses of a sub call or list, or opening square
bracket of an anonymous array, or opening curly brace of an anonymous
hash.  With this option, the above list would become:

    # perltidy -lp
    @month_of_year = (
                       'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                       'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
    );

If the available line length (see B<-l=n> ) does not permit this much 
space, perltidy will use less.   For alternate placement of the
closing paren, see the next section.

This option has no effect on code BLOCKS, such as if/then/else blocks,
which always use whatever is specified with B<-i=n>.  Also, the
existence of line breaks and/or block comments between the opening and
closing parens may cause perltidy to temporarily revert to its default
method.

Note: The B<-lp> option may not be used together with the B<-t> tabs option.
It may, however, be used with the B<-et=n> tab method.

In addition, any parameter which significantly restricts the ability of
perltidy to choose newlines will conflict with B<-lp> and will cause
B<-lp> to be deactivated.  These include B<-io>, B<-fnl>, B<-nanl>, and
B<-ndnl>.  The reason is that the B<-lp> indentation style can require
the careful coordination of an arbitrary number of break points in
hierarchical lists, and these flags may prevent that.

=item B<-cti=n>, B<--closing-token-indentation>

The B<-cti=n> flag controls the indentation of a line beginning with 
a C<)>, C<]>, or a non-block C<}>.  Such a line receives:

 -cti = 0 no extra indentation (default)
 -cti = 1 extra indentation such that the closing token
        aligns with its opening token.
 -cti = 2 one extra indentation level if the line looks like:
        );  or  ];  or  };
 -cti = 3 one extra indentation level always

The flags B<-cti=1> and B<-cti=2> work well with the B<-lp> flag (previous
section).
    
    # perltidy -lp -cti=1
    @month_of_year = (
                       'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                       'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
                     );

    # perltidy -lp -cti=2
    @month_of_year = (
                       'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                       'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
                       );

These flags are merely hints to the formatter and they may not always be
followed.  In particular, if -lp is not being used, the indentation for
B<cti=1> is constrained to be no more than one indentation level.

If desired, this control can be applied independently to each of the
closing container token types.  In fact, B<-cti=n> is merely an
abbreviation for B<-cpi=n -csbi=n -cbi=n>, where:  
B<-cpi> or B<--closing-paren-indentation> controls B<)>'s,
B<-csbi> or B<--closing-square-bracket-indentation> controls B<]>'s, 
B<-cbi> or B<--closing-brace-indentation> controls non-block B<}>'s. 

=item B<-icp>, B<--indent-closing-paren>

The B<-icp> flag is equivalent to
B<-cti=2>, described in the previous section.  The B<-nicp> flag is
equivalent B<-cti=0>.  They are included for backwards compatibility.

=item B<-icb>, B<--indent-closing-brace>

The B<-icb> option gives one extra level of indentation to a brace which
terminates a code block .  For example,

        if ($task) {
            yyy();
            }    # -icb
        else {
            zzz();
            }

The default is not to do this, indicated by B<-nicb>.

=item B<-olq>, B<--outdent-long-quotes>

When B<-olq> is set, lines which is a quoted string longer than the
value B<maximum-line-length> will have their indentation removed to make
them more readable.  This is the default.  To prevent such out-denting,
use B<-nolq> or B<--nooutdent-long-lines>.

=item B<-oll>, B<--outdent-long-lines>

This command is equivalent to B<--outdent-long-quotes> and
B<--outdent-long-comments>, and it is included for compatibility with previous
versions of perltidy.  The negation of this also works, B<-noll> or
B<--nooutdent-long-lines>, and is equivalent to setting B<-nolq> and B<-nolc>.

=item Outdenting Labels: B<-ola>,  B<--outdent-labels>

This command will cause labels to be outdented by 2 spaces (or whatever B<-ci>
has been set to), if possible.  This is the default.  For example:

        my $i;
      LOOP: while ( $i = <FOTOS> ) {
            chomp($i);
            next unless $i;
            fixit($i);
        }

Use B<-nola> to not outdent labels. 

=item Outdenting Keywords

=over 4

=item B<-okw>,  B<--outdent-keywords>

The command B<-okw> will cause certain leading control keywords to
be outdented by 2 spaces (or whatever B<-ci> has been set to), if
possible.  By default, these keywords are C<redo>, C<next>, C<last>,
C<goto>, and C<return>.  The intention is to make these control keywords
easier to see.  To change this list of keywords being outdented, see
the next section.

For example, using C<perltidy -okw> on the previous example gives:

        my $i;
      LOOP: while ( $i = <FOTOS> ) {
            chomp($i);
          next unless $i;
            fixit($i);
        }

The default is not to do this.  

=item Specifying Outdented Keywords: B<-okwl=string>,  B<--outdent-keyword-list=string>

This command can be used to change the keywords which are outdented with
the B<-okw> command.  The parameter B<string> is a required list of perl
keywords, which should be placed in quotes if there are more than one.
By itself, it does not cause any outdenting to occur, so the B<-okw>
command is still required.

For example, the commands C<-okwl="next last redo goto" -okw> will cause
those four keywords to be outdented.  It is probably simplest to place
any B<-okwl> command in a F<.perltidyrc> file.

=back

=back

=head2 Whitespace Control

Whitespace refers to the blank space between variables, operators,
and other code tokens.

=over 4

=item B<-fws>,  B<--freeze-whitespace>

This flag causes your original whitespace to remain unchanged, and
causes the rest of the whitespace commands in this section, the
Code Indentation section, and
the Comment Control section to be ignored.

=item Tightness of curly braces, parentheses, and square brackets.

Here the term "tightness" will mean the closeness with which
pairs of enclosing tokens, such as parentheses, contain the quantities
within.  A numerical value of 0, 1, or 2 defines the tightness, with
0 being least tight and 2 being most tight.  Spaces within containers
are always symmetric, so if there is a space after a C<(> then there
will be a space before the corresponding C<)>.

The B<-pt=n> or B<--paren-tightness=n> parameter controls the space within
parens.  The example below shows the effect of the three possible
values, 0, 1, and 2:

 if ( ( my $len_tab = length( $tabstr ) ) > 0 ) {  # -pt=0
 if ( ( my $len_tab = length($tabstr) ) > 0 ) {    # -pt=1 (default)
 if ((my $len_tab = length($tabstr)) > 0) {        # -pt=2

When n is 0, there is always a space to the right of a '(' and to the left
of a ')'.  For n=2 there is never a space.  For n=1, the default, there
is a space unless the quantity within the parens is a single token, such
as an identifier or quoted string.  

Likewise, the parameter B<-sbt=n> or B<--square-bracket-tightness=n>
controls the space within square brackets, as illustrated below.

 $width = $col[ $j + $k ] - $col[ $j ];  # -sbt=0
 $width = $col[ $j + $k ] - $col[$j];    # -sbt=1 (default)
 $width = $col[$j + $k] - $col[$j];      # -sbt=2 

Curly braces which do not contain code blocks are controlled by
the parameter B<-bt=n> or B<--brace-tightness=n>. 

 $obj->{ $parsed_sql->{ 'table' }[0] };    # -bt=0
 $obj->{ $parsed_sql->{'table'}[0] };      # -bt=1 (default)
 $obj->{$parsed_sql->{'table'}[0]};        # -bt=2

And finally, curly braces which contain blocks of code are controlled by the
parameter B<-bbt=n> or B<--block-brace-tightness=n> as illustrated in the
example below.   

 %bf = map { $_ => -M $_ } grep { /\.deb$/ } dirents '.'; # -bbt=0 (default)
 %bf = map { $_ => -M $_ } grep {/\.deb$/} dirents '.';   # -bbt=1
 %bf = map {$_ => -M $_} grep {/\.deb$/} dirents '.';     # -bbt=2

To simplify input in the case that all of the tightness flags have the same
value <n>, the parameter <-act=n> or B<--all-containers-tightness=n> is an
abbreviation for the combination <-pt=n -sbt=n -bt=n -bbt=n>.


=item B<-tso>,   B<--tight-secret-operators>

The flag B<-tso> causes certain perl token sequences (secret operators)
which might be considered to be a single operator to be formatted "tightly"
(without spaces).  The operators currently modified by this flag are: 

     0+  +0  ()x!! ~~<>  ,=>   =( )=  

For example the sequence B<0 +>,  which converts a string to a number,
would be formatted without a space: B<0+> when the B<-tso> flag is set.  This
flag is off by default.

=item B<-sts>,   B<--space-terminal-semicolon>

Some programmers prefer a space before all terminal semicolons.  The
default is for no such space, and is indicated with B<-nsts> or
B<--nospace-terminal-semicolon>.

	$i = 1 ;     #  -sts
	$i = 1;      #  -nsts   (default)

=item B<-sfs>,   B<--space-for-semicolon>

Semicolons within B<for> loops may sometimes be hard to see,
particularly when commas are also present.  This option places spaces on
both sides of these special semicolons, and is the default.  Use
B<-nsfs> or B<--nospace-for-semicolon> to deactivate it.

 for ( @a = @$ap, $u = shift @a ; @a ; $u = $v ) {  # -sfs (default)
 for ( @a = @$ap, $u = shift @a; @a; $u = $v ) {    # -nsfs

=item B<-asc>,  B<--add-semicolons>

Setting B<-asc> allows perltidy to add any missing optional semicolon at the end 
of a line which is followed by a closing curly brace on the next line.  This
is the default, and may be deactivated with B<-nasc> or B<--noadd-semicolons>.

=item B<-dsm>,  B<--delete-semicolons>

Setting B<-dsm> allows perltidy to delete extra semicolons which are
simply empty statements.  This is the default, and may be deactivated
with B<-ndsm> or B<--nodelete-semicolons>.  (Such semicolons are not
deleted, however, if they would promote a side comment to a block
comment).

=item B<-aws>,  B<--add-whitespace>

Setting this option allows perltidy to add certain whitespace improve
code readability.  This is the default. If you do not want any
whitespace added, but are willing to have some whitespace deleted, use
B<-naws>.  (Use B<-fws> to leave whitespace completely unchanged).

=item B<-dws>,  B<--delete-old-whitespace>

Setting this option allows perltidy to remove some old whitespace
between characters, if necessary.  This is the default.  If you
do not want any old whitespace removed, use B<-ndws> or
B<--nodelete-old-whitespace>.

=item Detailed whitespace controls around tokens

For those who want more detailed control over the whitespace around
tokens, there are four parameters which can directly modify the default
whitespace rules built into perltidy for any token.  They are:

B<-wls=s> or B<--want-left-space=s>,

B<-nwls=s> or B<--nowant-left-space=s>,

B<-wrs=s> or B<--want-right-space=s>,

B<-nwrs=s> or B<--nowant-right-space=s>.

These parameters are each followed by a quoted string, B<s>, containing a
list of token types.  No more than one of each of these parameters
should be specified, because repeating a command-line parameter
always overwrites the previous one before perltidy ever sees it.

To illustrate how these are used, suppose it is desired that there be no
space on either side of the token types B<= + - / *>.  The following two
parameters would specify this desire:

  -nwls="= + - / *"    -nwrs="= + - / *"

(Note that the token types are in quotes, and that they are separated by
spaces).  With these modified whitespace rules, the following line of math:

  $root = -$b + sqrt( $b * $b - 4. * $a * $c ) / ( 2. * $a );

becomes this:

  $root=-$b+sqrt( $b*$b-4.*$a*$c )/( 2.*$a );

These parameters should be considered to be hints to perltidy rather
than fixed rules, because perltidy must try to resolve conflicts that
arise between them and all of the other rules that it uses.  One
conflict that can arise is if, between two tokens, the left token wants
a space and the right one doesn't.  In this case, the token not wanting
a space takes priority.  

It is necessary to have a list of all token types in order to create
this type of input.  Such a list can be obtained by the command
B<--dump-token-types>.  Also try the B<-D> flag on a short snippet of code
and look at the .DEBUG file to see the tokenization. 

B<WARNING> Be sure to put these tokens in quotes to avoid having them
misinterpreted by your command shell.

=item Space between specific keywords and opening paren

When an opening paren follows a Perl keyword, no space is introduced after the
keyword, unless it is (by default) one of these:

   my local our and or eq ne if else elsif until unless 
   while for foreach return switch case given when

These defaults can be modified with two commands:

B<-sak=s>  or B<--space-after-keyword=s>  adds keywords.

B<-nsak=s>  or B<--nospace-after-keyword=s>  removes keywords.

where B<s> is a list of keywords (in quotes if necessary).  For example, 

  my ( $a, $b, $c ) = @_;    # default
  my( $a, $b, $c ) = @_;     # -nsak="my local our"

The abbreviation B<-nsak='*'> is equivalent to including all of the
keywords in the above list.

When both B<-nsak=s> and B<-sak=s> commands are included, the B<-nsak=s>
command is executed first.  For example, to have space after only the
keywords (my, local, our) you could use B<-nsak="*" -sak="my local our">.

To put a space after all keywords, see the next item.

=item Space between all keywords and opening parens

When an opening paren follows a function or keyword, no space is introduced
after the keyword except for the keywords noted in the previous item.  To
always put a space between a function or keyword and its opening paren,
use the command:

B<-skp>  or B<--space-keyword-paren>

You will probably also want to use the flag B<-sfp> (next item) too.

=item Space between all function names and opening parens

When an opening paren follows a function the default is not to introduce
a space.  To cause a space to be introduced use:

B<-sfp>  or B<--space-function-paren>

  myfunc( $a, $b, $c );    # default 
  myfunc ( $a, $b, $c );   # -sfp

You will probably also want to use the flag B<-skp> (previous item) too.

=item B<-spp=n>  or B<--space-prototype-paren=n>

This flag can be used to control whether a function prototype is preceded by a space.  For example, the following prototype does not have a space.

      sub usage();

This integer B<n> may have the value 0, 1, or 2 as follows:

    -spp=0 means no space before the paren
    -spp=1 means follow the example of the source code [DEFAULT]
    -spp=2 means always put a space before the paren

The default is B<-spp=1>, meaning that a space will be used if and only if there is one in the source code.  Given the above line of code, the result of
applying the different options would be:

        sub usage();    # n=0 [no space]
        sub usage();    # n=1 [default; follows input]
        sub usage ();   # n=2 [space]

=item Trimming whitespace around C<qw> quotes

B<-tqw> or B<--trim-qw> provide the default behavior of trimming
spaces around multi-line C<qw> quotes and indenting them appropriately.

B<-ntqw> or B<--notrim-qw> cause leading and trailing whitespace around
multi-line C<qw> quotes to be left unchanged.  This option will not
normally be necessary, but was added for testing purposes, because in
some versions of perl, trimming C<qw> quotes changes the syntax tree.

=item B<-sbq=n>  or B<--space-backslash-quote=n>

Lines like

       $str1=\"string1";
       $str2=\'string2';

can confuse syntax highlighters unless a space is included between the backslash and the single or double quotation mark.

This can be controlled with the value of B<n> as follows:

    -sbq=0 means no space between the backslash and quote
    -sbq=1 means follow the example of the source code
    -sbq=2 means always put a space between the backslash and quote

The default is B<-sbq=1>, meaning that a space will be used 0if there is one in the source code.

=item Trimming trailing whitespace from lines of POD

B<-trp> or B<--trim-pod> will remove trailing whitespace from lines of POD.
The default is not to do this.

=back

=head2 Comment Controls

Perltidy has a number of ways to control the appearance of both block comments
and side comments.  The term B<block comment> here refers to a full-line
comment, whereas B<side comment> will refer to a comment which appears on a
line to the right of some code.

=over 4

=item B<-ibc>,  B<--indent-block-comments>

Block comments normally look best when they are indented to the same
level as the code which follows them.  This is the default behavior, but
you may use B<-nibc> to keep block comments left-justified.  Here is an
example:

             # this comment is indented      (-ibc, default)
	     if ($task) { yyy(); }

The alternative is B<-nibc>:

 # this comment is not indented              (-nibc)
	     if ($task) { yyy(); }

See also the next item, B<-isbc>, as well as B<-sbc>, for other ways to
have some indented and some outdented block comments.

=item B<-isbc>,  B<--indent-spaced-block-comments>

If there is no leading space on the line, then the comment will not be
indented, and otherwise it may be.

If both B<-ibc> and B<-isbc> are set, then B<-isbc> takes priority.

=item B<-olc>, B<--outdent-long-comments>

When B<-olc> is set, lines which are full-line (block) comments longer
than the value B<maximum-line-length> will have their indentation
removed.  This is the default; use B<-nolc> to prevent outdenting.

=item B<-msc=n>,  B<--minimum-space-to-comment=n>

Side comments look best when lined up several spaces to the right of
code.  Perltidy will try to keep comments at least n spaces to the
right.  The default is n=4 spaces.

=item B<-fpsc=n>,  B<--fixed-position-side-comment=n>

This parameter tells perltidy to line up side comments in column number B<n>
whenever possible.  The default, n=0, will not do this.

=item B<-iscl>,  B<--ignore-side-comment-lengths>

This parameter causes perltidy to ignore the length of side comments when
setting line breaks.  The default, B<-niscl>, is to include the length of 
side comments when breaking lines to stay within the length prescribed
by the B<-l=n> maximum line length parameter.  For example, the following
long single line would remain intact with -l=80 and -iscl:

     perltidy -l=80 -iscl
        $vmsfile =~ s/;[\d\-]*$//; # Clip off version number; we can use a newer version as well

whereas without the -iscl flag the line will be broken:

     perltidy -l=80
        $vmsfile =~ s/;[\d\-]*$//
          ;    # Clip off version number; we can use a newer version as well
   

=item B<-hsc>, B<--hanging-side-comments>

By default, perltidy tries to identify and align "hanging side
comments", which are something like this:

        my $IGNORE = 0;    # This is a side comment
                           # This is a hanging side comment
                           # And so is this

A comment is considered to be a hanging side comment if (1) it immediately
follows a line with a side comment, or another hanging side comment, and
(2) there is some leading whitespace on the line.
To deactivate this feature, use B<-nhsc> or B<--nohanging-side-comments>.  
If block comments are preceded by a blank line, or have no leading
whitespace, they will not be mistaken as hanging side comments.

=item Closing Side Comments

A closing side comment is a special comment which perltidy can
automatically create and place after the closing brace of a code block.
They can be useful for code maintenance and debugging.  The command
B<-csc> (or B<--closing-side-comments>) adds or updates closing side
comments.  For example, here is a small code snippet

        sub message {
            if ( !defined( $_[0] ) ) {
                print("Hello, World\n");
            }
            else {
                print( $_[0], "\n" );
            }
        }

And here is the result of processing with C<perltidy -csc>:

        sub message {
            if ( !defined( $_[0] ) ) {
                print("Hello, World\n");
            }
            else {
                print( $_[0], "\n" );
            }
        } ## end sub message

A closing side comment was added for C<sub message> in this case, but not
for the C<if> and C<else> blocks, because they were below the 6 line
cutoff limit for adding closing side comments.  This limit may be
changed with the B<-csci> command, described below.

The command B<-dcsc> (or B<--delete-closing-side-comments>) reverses this 
process and removes these comments.

Several commands are available to modify the behavior of these two basic
commands, B<-csc> and B<-dcsc>:

=over 4

=item B<-csci=n>, or B<--closing-side-comment-interval=n> 

where C<n> is the minimum number of lines that a block must have in
order for a closing side comment to be added.  The default value is
C<n=6>.  To illustrate:

        # perltidy -csci=2 -csc
        sub message {
            if ( !defined( $_[0] ) ) {
                print("Hello, World\n");
            } ## end if ( !defined( $_[0] ))
            else {
                print( $_[0], "\n" );
            } ## end else [ if ( !defined( $_[0] ))
        } ## end sub message

Now the C<if> and C<else> blocks are commented.  However, now this has
become very cluttered.

=item B<-cscp=string>, or B<--closing-side-comment-prefix=string> 

where string is the prefix used before the name of the block type.  The
default prefix, shown above, is C<## end>.  This string will be added to
closing side comments, and it will also be used to recognize them in
order to update, delete, and format them.  Any comment identified as a
closing side comment will be placed just a single space to the right of
its closing brace.

=item B<-cscl=string>, or B<--closing-side-comment-list> 

where C<string> is a list of block types to be tagged with closing side
comments.  By default, all code block types preceded by a keyword or
label (such as C<if>, C<sub>, and so on) will be tagged.  The B<-cscl>
command changes the default list to be any selected block types; see
L<Specifying Block Types>.
For example, the following command
requests that only C<sub>'s, labels, C<BEGIN>, and C<END> blocks be
affected by any B<-csc> or B<-dcsc> operation:

   -cscl="sub : BEGIN END"

=item B<-csct=n>, or B<--closing-side-comment-maximum-text=n> 

The text appended to certain block types, such as an C<if> block, is
whatever lies between the keyword introducing the block, such as C<if>,
and the opening brace.  Since this might be too much text for a side
comment, there needs to be a limit, and that is the purpose of this
parameter.  The default value is C<n=20>, meaning that no additional
tokens will be appended to this text after its length reaches 20
characters.  Omitted text is indicated with C<...>.  (Tokens, including
sub names, are never truncated, however, so actual lengths may exceed
this).  To illustrate, in the above example, the appended text of the
first block is C< ( !defined( $_[0] )...>.  The existing limit of
C<n=20> caused this text to be truncated, as indicated by the C<...>.  See
the next flag for additional control of the abbreviated text.

=item B<-cscb>, or B<--closing-side-comments-balanced> 

As discussed in the previous item, when the
closing-side-comment-maximum-text limit is exceeded the comment text must
be truncated.  Older versions of perltidy terminated with three dots, and this
can still be achieved with -ncscb:

  perltidy -csc -ncscb
  } ## end foreach my $foo (sort { $b cmp $a ...

However this causes a problem with editors which cannot recognize
comments or are not configured to do so because they cannot "bounce" around in
the text correctly.  The B<-cscb> flag has been added to
help them by appending appropriate balancing structure:

  perltidy -csc -cscb
  } ## end foreach my $foo (sort { $b cmp $a ... })

The default is B<-cscb>.

=item B<-csce=n>, or B<--closing-side-comment-else-flag=n> 

The default, B<n=0>, places the text of the opening C<if> statement after any
terminal C<else>.

If B<n=2> is used, then each C<elsif> is also given the text of the opening
C<if> statement.  Also, an C<else> will include the text of a preceding
C<elsif> statement.  Note that this may result some long closing
side comments.

If B<n=1> is used, the results will be the same as B<n=2> whenever the
resulting line length is less than the maximum allowed.

=item B<-cscb>, or B<--closing-side-comments-balanced> 

When using closing-side-comments, and the closing-side-comment-maximum-text
limit is exceeded, then the comment text must be abbreviated.  
It is terminated with three dots if the B<-cscb> flag is negated:

  perltidy -csc -ncscb
  } ## end foreach my $foo (sort { $b cmp $a ...

This causes a problem with older editors which do not recognize comments
because they cannot "bounce" around in the text correctly.  The B<-cscb>
flag tries to help them by appending appropriate terminal balancing structures:

  perltidy -csc -cscb
  } ## end foreach my $foo (sort { $b cmp $a ... })

The default is B<-cscb>.  


=item B<-cscw>, or B<--closing-side-comment-warnings> 

This parameter is intended to help make the initial transition to the use of
closing side comments.  
It causes two
things to happen if a closing side comment replaces an existing, different
closing side comment:  first, an error message will be issued, and second, the
original side comment will be placed alone on a new specially marked comment
line for later attention. 

The intent is to avoid clobbering existing hand-written side comments
which happen to match the pattern of closing side comments. This flag
should only be needed on the first run with B<-csc>.

=back

B<Important Notes on Closing Side Comments:> 

=over 4

=item *

Closing side comments are only placed on lines terminated with a closing
brace.  Certain closing styles, such as the use of cuddled elses
(B<-ce>), preclude the generation of some closing side comments.

=item *

Please note that adding or deleting of closing side comments takes
place only through the commands B<-csc> or B<-dcsc>.  The other commands,
if used, merely modify the behavior of these two commands.  

=item *

It is recommended that the B<-cscw> flag be used along with B<-csc> on
the first use of perltidy on a given file.  This will prevent loss of
any existing side comment data which happens to have the csc prefix.

=item *

Once you use B<-csc>, you should continue to use it so that any
closing side comments remain correct as code changes.  Otherwise, these
comments will become incorrect as the code is updated.

=item *

If you edit the closing side comments generated by perltidy, you must also
change the prefix to be different from the closing side comment prefix.
Otherwise, your edits will be lost when you rerun perltidy with B<-csc>.   For
example, you could simply change C<## end> to be C<## End>, since the test is
case sensitive.  You may also want to use the B<-ssc> flag to keep these
modified closing side comments spaced the same as actual closing side comments.

=item *

Temporarily generating closing side comments is a useful technique for
exploring and/or debugging a perl script, especially one written by someone
else.  You can always remove them with B<-dcsc>.

=back

=item Static Block Comments

Static block comments are block comments with a special leading pattern,
C<##> by default, which will be treated slightly differently from other
block comments.  They effectively behave as if they had glue along their
left and top edges, because they stick to the left edge and previous line
when there is no blank spaces in those places.  This option is
particularly useful for controlling how commented code is displayed.

=over 4

=item B<-sbc>, B<--static-block-comments>

When B<-sbc> is used, a block comment with a special leading pattern, C<##> by
default, will be treated specially. 

Comments so identified  are treated as follows: 

=over 4

=item *

If there is no leading space on the line, then the comment will not
be indented, and otherwise it may be,

=item *

no new blank line will be
inserted before such a comment, and 

=item *

such a comment will never become
a hanging side comment.  

=back

For example, assuming C<@month_of_year> is
left-adjusted:

    @month_of_year = (    # -sbc (default)
        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
    ##  'Dec', 'Nov'
        'Nov', 'Dec');

Without this convention, the above code would become

    @month_of_year = (   # -nsbc
        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
  
        ##  'Dec', 'Nov'
        'Nov', 'Dec'
    );

which is not as clear.
The default is to use B<-sbc>.  This may be deactivated with B<-nsbc>.

=item B<-sbcp=string>, B<--static-block-comment-prefix=string>

This parameter defines the prefix used to identify static block comments
when the B<-sbc> parameter is set.  The default prefix is C<##>,
corresponding to C<-sbcp=##>.  The prefix is actually part of a perl 
pattern used to match lines and it must either begin with C<#> or C<^#>.  
In the first case a prefix ^\s* will be added to match any leading
whitespace, while in the second case the pattern will match only
comments with no leading whitespace.  For example, to
identify all comments as static block comments, one would use C<-sbcp=#>.
To identify all left-adjusted comments as static block comments, use C<-sbcp='^#'>.

Please note that B<-sbcp> merely defines the pattern used to identify static
block comments; it will not be used unless the switch B<-sbc> is set.  Also,
please be aware that since this string is used in a perl regular expression
which identifies these comments, it must enable a valid regular expression to
be formed.

A pattern which can be useful is:

    -sbcp=^#{2,}[^\s#] 

This pattern requires a static block comment to have at least one character
which is neither a # nor a space.  It allows a line containing only '#'
characters to be rejected as a static block comment.  Such lines are often used
at the start and end of header information in subroutines and should not be
separated from the intervening comments, which typically begin with just a
single '#'.

=item B<-osbc>, B<--outdent-static-block-comments>

The command B<-osbc> will cause static block comments to be outdented by 2
spaces (or whatever B<-ci=n> has been set to), if possible.

=back

=item Static Side Comments

Static side comments are side comments with a special leading pattern.
This option can be useful for controlling how commented code is displayed
when it is a side comment.

=over 4

=item B<-ssc>, B<--static-side-comments>

When B<-ssc> is used, a side comment with a static leading pattern, which is
C<##> by default, will be spaced only a single space from previous
character, and it will not be vertically aligned with other side comments.

The default is B<-nssc>.

=item B<-sscp=string>, B<--static-side-comment-prefix=string>

This parameter defines the prefix used to identify static side comments
when the B<-ssc> parameter is set.  The default prefix is C<##>,
corresponding to C<-sscp=##>.  

Please note that B<-sscp> merely defines the pattern used to identify
static side comments; it will not be used unless the switch B<-ssc> is
set.  Also, note that this string is used in a perl regular expression
which identifies these comments, so it must enable a valid regular
expression to be formed.

=back


=back

=head2 Skipping Selected Sections of Code

Selected lines of code may be passed verbatim to the output without any
formatting.  This feature is enabled by default but can be disabled with
the B<--noformat-skipping> or B<-nfs> flag.  It should be used sparingly to
avoid littering code with markers, but it might be helpful for working
around occasional problems.  For example it might be useful for keeping
the indentation of old commented code unchanged, keeping indentation of
long blocks of aligned comments unchanged, keeping certain list
formatting unchanged, or working around a glitch in perltidy.

=over 4

=item B<-fs>,  B<--format-skipping>

This flag, which is enabled by default, causes any code between
special beginning and ending comment markers to be passed to the
output without formatting.  The default beginning marker is #<<<
and the default ending marker is #>>> but they
may be changed (see next items below).  Additional text may appear on
these special comment lines provided that it is separated from the
marker by at least one space.  For example

 #<<<  do not let perltidy touch this
    my @list = (1,
                1, 1,
                1, 2, 1,
                1, 3, 3, 1,
                1, 4, 6, 4, 1,);
 #>>>

The comment markers may be placed at any location that a block comment may
appear.  If they do not appear to be working, use the -log flag and examine the
F<.LOG> file.  Use B<-nfs> to disable this feature.

=item B<-fsb=string>,  B<--format-skipping-begin=string>

The B<-fsb=string> parameter may be used to change the beginning marker for
format skipping.  The default is equivalent to -fsb='#<<<'.  The string that
you enter must begin with a # and should be in quotes as necessary to get past
the command shell of your system.  It is actually the leading text of a pattern
that is constructed by appending a '\s', so you must also include backslashes
for characters to be taken literally rather than as patterns.  

Some examples show how example strings become patterns:

 -fsb='#\{\{\{' becomes /^#\{\{\{\s/  which matches  #{{{ but not #{{{{
 -fsb='#\*\*'   becomes /^#\*\*\s/    which matches  #** but not #***
 -fsb='#\*{2,}' becomes /^#\*{2,}\s/  which matches  #** and #***** 

=item B<-fse=string>,  B<--format-skipping-end=string>

The B<-fsb=string> is the corresponding parameter used to change the
ending marker for format skipping.  The default is equivalent to
-fse='#<<<'.  

=back

=head2 Line Break Control

The parameters in this section control breaks after
non-blank lines of code.  Blank lines are controlled
separately by parameters in the section L<Blank Line
Control>.

=over 4

=item B<-fnl>,  B<--freeze-newlines>

If you do not want any changes to the line breaks within
lines of code in your script, set
B<-fnl>, and they will remain fixed, and the rest of the commands in
this section and sections 
L<Controlling List Formatting>,
L<Retaining or Ignoring Existing Line Breaks>. 
You may want to use B<-noll> with this.

Note: If you also want to keep your blank lines exactly
as they are, you can use the B<-fbl> flag which is described
in the section L<Blank Line Control>.

=item B<-ce>,   B<--cuddled-else>

Enable the "cuddled else" style, in which C<else> and C<elsif> are
follow immediately after the curly brace closing the previous block.
The default is not to use cuddled elses, and is indicated with the flag
B<-nce> or B<--nocuddled-else>.  Here is a comparison of the
alternatives:

  # -ce
  if ($task) {
      yyy();
  } else {    
      zzz();
  }

  # -nce (default)
  if ($task) {
	yyy();
  }
  else {    
	zzz();
  }

In this example the keyword B<else> is placed on the same line which begins with
the preceding closing block brace and is followed by its own opening block brace
on the same line.  Other keywords and function names which are formatted with
this "cuddled" style are B<elsif>, B<continue>, B<catch>, B<finally>.

Other block types can be formatted by specifying their names on a 
separate parameter B<-cbl>, described in a later section.  

Cuddling between a pair of code blocks requires that the closing brace of the
first block start a new line.  If this block is entirely on one line in the
input file, it is necessary to decide if it should be broken to allow cuddling.
This decision is controlled by the flag B<-cbo=n> discussed below.  The default
and recommended value of B<-cbo=1> bases this decision on the first block in
the chain.  If it spans multiple lines then cuddling is made and continues
along the chain, regardless of the sizes of subsequent blocks. Otherwise, short
lines remain intact.

So for example, the B<-ce> flag would not have any effect if the above snippet
is rewritten as

  if ($task) { yyy() }
  else {    zzz() }

If the first block spans multiple lines, then cuddling can be done and will
continue for the subsequent blocks in the chain, as illustrated in the previous
snippet.

If there are blank lines between cuddled blocks they will be eliminated.  If
there are comments after the closing brace where cuddling would occur then
cuddling will be prevented.  If this occurs, cuddling will restart later in the
chain if possible.  

=item B<-cb>,   B<--cuddled-blocks>

This flag is equivalent to B<-ce>. 


=item B<-cbl>,    B<--cuddled-block-list>     

The built-in default cuddled block types are B<else, elsif, continue, catch, finally>.

Additional block types to which the B<-cuddled-blocks> style applies can be defined by
this parameter.  This parameter is a character string, giving a list of
block types separated by commas or spaces.  For example, to cuddle code blocks
of type sort, map and grep, in addition to the default types, the string could
be set to
  
  -cbl="sort map grep"

or equivalently

  -cbl=sort,map,grep 

Note however that these particular block types are typically short so there might not be much
opportunity for the cuddled format style.

Using commas avoids the need to protect spaces with quotes.

As a diagnostic check, the flag B<--dump-cuddled-block-list> or B<-dcbl> can be
used to view the hash of values that are generated by this flag. 

Finally, note that the B<-cbl> flag by itself merely specifies which blocks are formatted
with the cuddled format. It has no effect unless this formatting style is activated with
B<-ce>.

=item B<-cblx>,    B<--cuddled-block-list-exclusive>     

When cuddled else formatting is selected with B<-ce>, setting this flag causes
perltidy to ignore its built-in defaults and rely exclusively on the block types
specified on the B<-cbl> flag described in the previous section.  For example,
to avoid using cuddled B<catch> and B<finally>, which among in the defaults, the
following set of parameters could be used:

  perltidy -ce -cbl='else elsif continue' -cblx


=item B<-cbo=n>,   B<--cuddled-break-option=n>

Cuddled formatting is only possible between a pair of code blocks if the
closing brace of the first block starts a new line. If a block is encountered
which is entirely on a single line, and cuddled formatting is selected, it is
necessary to make a decision as to whether or not to "break" the block, meaning
to cause it to span multiple lines.  This parameter controls that decision. The
options are:

   cbo=0  Never force a short block to break.
   cbo=1  If the first of a pair of blocks is broken in the input file, 
          then break the second [DEFAULT].
   cbo=2  Break open all blocks for maximal cuddled formatting.

The default and recommended value is B<cbo=1>.  With this value, if the starting
block of a chain spans multiple lines, then a cascade of breaks will occur for
remaining blocks causing the entire chain to be cuddled.

The option B<cbo=0> can produce erratic cuddling if there are numerous one-line
blocks.

The option B<cbo=2> produces maximal cuddling but will not allow any short blocks.


=item B<-bl>,    B<--opening-brace-on-new-line>     

Use the flag B<-bl> to place the opening brace on a new line:

  if ( $input_file eq '-' )    # -bl 
  {                          
      important_function();
  }

This flag applies to all structural blocks, including named sub's (unless
the B<-sbl> flag is set -- see next item).

The default style, B<-nbl>, places an opening brace on the same line as
the keyword introducing it.  For example,

  if ( $input_file eq '-' ) {   # -nbl (default)

=item B<-sbl>,    B<--opening-sub-brace-on-new-line>     

The flag B<-sbl> can be used to override the value of B<-bl> for
the opening braces of named sub's.  For example, 

 perltidy -sbl

produces this result:

 sub message
 {
    if (!defined($_[0])) {
        print("Hello, World\n");
    }
    else {
        print($_[0], "\n");
    }
 }

This flag is negated with B<-nsbl>.  If B<-sbl> is not specified,
the value of B<-bl> is used.

=item B<-asbl>,    B<--opening-anonymous-sub-brace-on-new-line>     

The flag B<-asbl> is like the B<-sbl> flag except that it applies
to anonymous sub's instead of named subs. For example

 perltidy -asbl

produces this result:

 $a = sub
 {
     if ( !defined( $_[0] ) ) {
         print("Hello, World\n");
     }
     else {
         print( $_[0], "\n" );
     }
 };

This flag is negated with B<-nasbl>, and the default is B<-nasbl>.

=item B<-bli>,    B<--brace-left-and-indent>     

The flag B<-bli> is the same as B<-bl> but in addition it causes one 
unit of continuation indentation ( see B<-ci> ) to be placed before 
an opening and closing block braces.

For example,

        if ( $input_file eq '-' )    # -bli
          {
            important_function();
          }

By default, this extra indentation occurs for blocks of type:
B<if>, B<elsif>, B<else>, B<unless>, B<for>, B<foreach>, B<sub>, 
B<while>, B<until>, and also with a preceding label.  The next item
shows how to change this.

=item B<-blil=s>,    B<--brace-left-and-indent-list=s>     

Use this parameter to change the types of block braces for which the
B<-bli> flag applies; see L<Specifying Block Types>.  For example,
B<-blil='if elsif else'> would apply it to only C<if/elsif/else> blocks.

=item B<-bar>,    B<--opening-brace-always-on-right>     

The default style, B<-nbl> places the opening code block brace on a new
line if it does not fit on the same line as the opening keyword, like
this:

        if ( $bigwasteofspace1 && $bigwasteofspace2
          || $bigwasteofspace3 && $bigwasteofspace4 )
        {
            big_waste_of_time();
        }

To force the opening brace to always be on the right, use the B<-bar>
flag.  In this case, the above example becomes

        if ( $bigwasteofspace1 && $bigwasteofspace2
          || $bigwasteofspace3 && $bigwasteofspace4 ) {
            big_waste_of_time();
        }

A conflict occurs if both B<-bl> and B<-bar> are specified.

=item B<-otr>,  B<--opening-token-right> and related flags

The B<-otr> flag is a hint that perltidy should not place a break between a
comma and an opening token.  For example:

    # default formatting
    push @{ $self->{$module}{$key} },
      {
        accno       => $ref->{accno},
        description => $ref->{description}
      };

    # perltidy -otr
    push @{ $self->{$module}{$key} }, {
        accno       => $ref->{accno},
        description => $ref->{description}
      };

The flag B<-otr> is actually an abbreviation for three other flags
which can be used to control parens, hash braces, and square brackets
separately if desired:

  -opr  or --opening-paren-right
  -ohbr or --opening-hash-brace-right
  -osbr or --opening-square-bracket-right

=item B<-wn>,  B<--weld-nested-containers> 

The B<-wn> flag causes closely nested pairs of opening and closing container
symbols (curly braces, brackets, or parens) to be "welded" together, meaning
that they are treated as if combined into a single unit, with the indentation
of the innermost code reduced to be as if there were just a single container
symbol.

For example:

	# default formatting
        do {
            {
                next if $x == $y;    
            }
        } until $x++ > $z;

	# perltidy -wn
        do { {
            next if $x == $y;
        } } until $x++ > $z;

When this flag is set perltidy makes a preliminary pass through the file and
identifies all nested pairs of containers.  To qualify as a nested pair, the
closing container symbols must be immediately adjacent. The opening symbols
must either be adjacent, or, if the outer opening symbol is an opening
paren, they may be separated by any single non-container symbol or something
that looks like a function evaluation.  

Any container symbol may serve as both the inner container of one pair and as
the outer container of an adjacent pair. Consequently, any number of adjacent
opening or closing symbols may join together in weld.  For example, here are
three levels of wrapped function calls:

	# default formatting
        my (@date_time) = Localtime(
            Date_to_Time(
                Add_Delta_DHMS(
                    $year, $month,  $day, $hour, $minute, $second,
                    '0',   $offset, '0',  '0'
                )
            )
        );

        # perltidy -wn
        my (@date_time) = Localtime( Date_to_Time( Add_Delta_DHMS(
            $year, $month,  $day, $hour, $minute, $second,
            '0',   $offset, '0',  '0'
        ) ) );

Notice how the indentation of the inner lines are reduced by two levels in this
case.  This example also shows the typical result of this formatting, namely it
is a sandwich consisting of an initial opening layer, a central section of any
complexity forming the "meat" of the sandwich, and a final closing layer.  This
predictable structure helps keep the compacted structure readable.

The inner sandwich layer is required to be at least one line thick.  If this
cannot be achieved, welding does not occur.  This constraint can cause
formatting to take a couple of iterations to stabilize when it is first applied
to a script. The B<-conv> flag can be used to insure that the final format is
achieved in a single run.

Here is an example illustrating a welded container within a welded containers:

	# default formatting
        $x->badd(
            bmul(
                $class->new(
                    abs(
                        $sx * int( $xr->numify() ) & $sy * int( $yr->numify() )
                    )
                ),
                $m
            )
        );

	# perltidy -wn
        $x->badd( bmul(
            $class->new( abs(
                $sx * int( $xr->numify() ) & $sy * int( $yr->numify() )
            ) ),
            $m
        ) );

This format option is quite general but there are some limitations.  

One limitation is that any line length limit still applies and can cause long
welded sections to be broken into multiple lines.  

Another limitation is that an opening symbol which delimits quoted text cannot
be included in a welded pair.  This is because quote delimiters are treated
specially in perltidy.  

Finally, the stacking of containers defined by this flag have priority over
any other container stacking flags.  This is because any welding is done first.


=item B<Vertical tightness> of non-block curly braces, parentheses, and square brackets.

These parameters control what shall be called vertical tightness.  Here are the
main points:

=over 4

=item *

Opening tokens (except for block braces) are controlled by B<-vt=n>, or
B<--vertical-tightness=n>, where

 -vt=0 always break a line after opening token (default). 
 -vt=1 do not break unless this would produce more than one 
         step in indentation in a line.
 -vt=2 never break a line after opening token

=item *

You must also use the B<-lp> flag when you use the B<-vt> flag; the
reason is explained below.

=item *

Closing tokens (except for block braces) are controlled by B<-vtc=n>, or
B<--vertical-tightness-closing=n>, where

 -vtc=0 always break a line before a closing token (default), 
 -vtc=1 do not break before a closing token which is followed 
        by a semicolon or another closing token, and is not in 
        a list environment.
 -vtc=2 never break before a closing token.

The rules for B<-vtc=1> are designed to maintain a reasonable balance
between tightness and readability in complex lists.

=item *

Different controls may be applied to different token types,
and it is also possible to control block braces; see below.

=item *

Finally, please note that these vertical tightness flags are merely
hints to the formatter, and it cannot always follow them.  Things which
make it difficult or impossible include comments, blank lines, blocks of
code within a list, and possibly the lack of the B<-lp> parameter.
Also, these flags may be ignored for very small lists (2 or 3 lines in
length).

=back

Here are some examples: 

    # perltidy -lp -vt=0 -vtc=0
    %romanNumerals = (
                       one   => 'I',
                       two   => 'II',
                       three => 'III',
                       four  => 'IV',
    );

    # perltidy -lp -vt=1 -vtc=0
    %romanNumerals = ( one   => 'I',
                       two   => 'II',
                       three => 'III',
                       four  => 'IV',
    );

    # perltidy -lp -vt=1 -vtc=1
    %romanNumerals = ( one   => 'I',
                       two   => 'II',
                       three => 'III',
                       four  => 'IV', );

The difference between B<-vt=1> and B<-vt=2> is shown here:

    # perltidy -lp -vt=1 
    $init->add(
                mysprintf( "(void)find_threadsv(%s);",
                           cstring( $threadsv_names[ $op->targ ] )
                )
    );

    # perltidy -lp -vt=2 
    $init->add( mysprintf( "(void)find_threadsv(%s);",
                           cstring( $threadsv_names[ $op->targ ] )
                )
    );

With B<-vt=1>, the line ending in C<add(> does not combine with the next
line because the next line is not balanced.  This can help with
readability, but B<-vt=2> can be used to ignore this rule.

The tightest, and least readable, code is produced with both C<-vt=2> and
C<-vtc=2>:

    # perltidy -lp -vt=2 -vtc=2
    $init->add( mysprintf( "(void)find_threadsv(%s);",
                           cstring( $threadsv_names[ $op->targ ] ) ) );

Notice how the code in all of these examples collapses vertically as
B<-vt> increases, but the indentation remains unchanged.  This is
because perltidy implements the B<-vt> parameter by first formatting as
if B<-vt=0>, and then simply overwriting one output line on top of the
next, if possible, to achieve the desired vertical tightness.  The
B<-lp> indentation style has been designed to allow this vertical
collapse to occur, which is why it is required for the B<-vt> parameter.

The B<-vt=n> and B<-vtc=n> parameters apply to each type of container
token.  If desired, vertical tightness controls can be applied
independently to each of the closing container token types.

The parameters for controlling parentheses are B<-pvt=n> or
B<--paren-vertical-tightness=n>, and B<-pcvt=n> or
B<--paren-vertical-tightness-closing=n>.

Likewise, the parameters for square brackets are B<-sbvt=n> or
B<--square-bracket-vertical-tightness=n>, and B<-sbcvt=n> or
B<--square-bracket-vertical-tightness-closing=n>.

Finally, the parameters for controlling non-code block braces are
B<-bvt=n> or B<--brace-vertical-tightness=n>, and B<-bcvt=n> or
B<--brace-vertical-tightness-closing=n>.

In fact, the parameter B<-vt=n> is actually just an abbreviation for
B<-pvt=n -bvt=n sbvt=n>, and likewise B<-vtc=n> is an abbreviation
for B<-pvtc=n -bvtc=n sbvtc=n>.

=item B<-bbvt=n> or B<--block-brace-vertical-tightness=n>

The B<-bbvt=n> flag is just like the B<-vt=n> flag but applies
to opening code block braces.

 -bbvt=0 break after opening block brace (default). 
 -bbvt=1 do not break unless this would produce more than one 
         step in indentation in a line.
 -bbvt=2 do not break after opening block brace.

It is necessary to also use either B<-bl> or B<-bli> for this to work,
because, as with other vertical tightness controls, it is implemented by
simply overwriting a line ending with an opening block brace with the
subsequent line.  For example:

    # perltidy -bli -bbvt=0
    if ( open( FILE, "< $File" ) )
      {
        while ( $File = <FILE> )
          {
            $In .= $File;
            $count++;
          }
        close(FILE);
      }

    # perltidy -bli -bbvt=1
    if ( open( FILE, "< $File" ) )
      { while ( $File = <FILE> )
          { $In .= $File;
            $count++;
          }
        close(FILE);
      }

By default this applies to blocks associated with keywords B<if>,
B<elsif>, B<else>, B<unless>, B<for>, B<foreach>, B<sub>, B<while>,
B<until>, and also with a preceding label.  This can be changed with
the parameter B<-bbvtl=string>, or
B<--block-brace-vertical-tightness-list=string>, where B<string> is a
space-separated list of block types.  For more information on the
possible values of this string, see L<Specifying Block Types>

For example, if we want to just apply this style to C<if>,
C<elsif>, and C<else> blocks, we could use 
C<perltidy -bli -bbvt=1 -bbvtl='if elsif else'>.

There is no vertical tightness control for closing block braces; with
one exception they will be placed on separate lines.
The exception is that a cascade of closing block braces may
be stacked on a single line.  See B<-scbb>.

=item B<-sot>,  B<--stack-opening-tokens> and related flags

The B<-sot> flag tells perltidy to "stack" opening tokens
when possible to avoid lines with isolated opening tokens.

For example:

    # default
    $opt_c = Text::CSV_XS->new(
        {
            binary       => 1,
            sep_char     => $opt_c,
            always_quote => 1,
        }
    );

    # -sot
    $opt_c = Text::CSV_XS->new( {
            binary       => 1,
            sep_char     => $opt_c,
            always_quote => 1,
        }
    );

For detailed control of individual closing tokens the following
controls can be used:

  -sop  or --stack-opening-paren
  -sohb or --stack-opening-hash-brace
  -sosb or --stack-opening-square-bracket
  -sobb or --stack-opening-block-brace

The flag B<-sot> is an abbreviation for B<-sop -sohb -sosb>.

The flag B<-sobb> is an abbreviation for B<-bbvt=2 -bbvtl='*'>.  This
will case a cascade of opening block braces to appear on a single line,
although this an uncommon occurrence except in test scripts. 

=item B<-sct>,  B<--stack-closing-tokens> and related flags

The B<-sct> flag tells perltidy to "stack" closing tokens
when possible to avoid lines with isolated closing tokens.

For example:

    # default
    $opt_c = Text::CSV_XS->new(
        {
            binary       => 1,
            sep_char     => $opt_c,
            always_quote => 1,
        }
    );

    # -sct
    $opt_c = Text::CSV_XS->new(
        {
            binary       => 1,
            sep_char     => $opt_c,
            always_quote => 1,
        } );

The B<-sct> flag is somewhat similar to the B<-vtc> flags, and in some
cases it can give a similar result.  The difference is that the B<-vtc>
flags try to avoid lines with leading opening tokens by "hiding" them at
the end of a previous line, whereas the B<-sct> flag merely tries to
reduce the number of lines with isolated closing tokens by stacking them
but does not try to hide them.  For example:

    # -vtc=2
    $opt_c = Text::CSV_XS->new(
        {
            binary       => 1,
            sep_char     => $opt_c,
            always_quote => 1, } );

For detailed control of the stacking of individual closing tokens the
following controls can be used:

  -scp  or --stack-closing-paren
  -schb or --stack-closing-hash-brace
  -scsb or --stack-closing-square-bracket
  -scbb or --stack-closing-block-brace

The flag B<-sct> is an abbreviation for stacking the non-block closing
tokens, B<-scp -schb -scsb>. 

Stacking of closing block braces, B<-scbb>, causes a cascade of isolated
closing block braces to be combined into a single line as in the following
example:

    # -scbb:
    for $w1 (@w1) {
        for $w2 (@w2) {
            for $w3 (@w3) {
                for $w4 (@w4) {
                    push( @lines, "$w1 $w2 $w3 $w4\n" );
                } } } }

To simplify input even further for the case in which both opening and closing
non-block containers are stacked, the flag B<-sac> or B<--stack-all-containers>
is an abbreviation for B<-sot -sot>.

=item B<-dnl>,  B<--delete-old-newlines>

By default, perltidy first deletes all old line break locations, and then it
looks for good break points to match the desired line length.  Use B<-ndnl>
or  B<--nodelete-old-newlines> to force perltidy to retain all old line break
points.  

=item B<-anl>,  B<--add-newlines>

By default, perltidy will add line breaks when necessary to create
continuations of long lines and to improve the script appearance.  Use
B<-nanl> or B<--noadd-newlines> to prevent any new line breaks.  

This flag does not prevent perltidy from eliminating existing line
breaks; see B<--freeze-newlines> to completely prevent changes to line
break points.

=item Controlling whether perltidy breaks before or after operators

Four command line parameters provide some control over whether
a line break should be before or after specific token types.
Two parameters give detailed control:

B<-wba=s> or B<--want-break-after=s>, and

B<-wbb=s> or B<--want-break-before=s>.

These parameters are each followed by a quoted string, B<s>, containing
a list of token types (separated only by spaces).  No more than one of each
of these parameters should be specified, because repeating a
command-line parameter always overwrites the previous one before
perltidy ever sees it.

By default, perltidy breaks B<after> these token types:
  % + - * / x != == >= <= =~ !~ < >  | & 
  = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x=

And perltidy breaks B<before> these token types by default:
  . << >> -> && || //

To illustrate, to cause a break after a concatenation operator, C<'.'>,
rather than before it, the command line would be

  -wba="."

As another example, the following command would cause a break before 
math operators C<'+'>, C<'-'>, C<'/'>, and C<'*'>:

  -wbb="+ - / *"

These commands should work well for most of the token types that perltidy uses
(use B<--dump-token-types> for a list).  Also try the B<-D> flag on a short
snippet of code and look at the .DEBUG file to see the tokenization.  However,
for a few token types there may be conflicts with hardwired logic which cause
unexpected results.  One example is curly braces, which should be controlled
with the parameter B<bl> provided for that purpose.

B<WARNING> Be sure to put these tokens in quotes to avoid having them
misinterpreted by your command shell.

Two additional parameters are available which, though they provide no further
capability, can simplify input are:

B<-baao> or B<--break-after-all-operators>,

B<-bbao> or B<--break-before-all-operators>.

The -baao sets the default to be to break after all of the following operators:

    % + - * / x != == >= <= =~ !~ < > | & 
    = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x=
    . : ? && || and or err xor

and the B<-bbao> flag sets the default to break before all of these operators.
These can be used to define an initial break preference which can be fine-tuned
with the B<-wba> and B<-wbb> flags.  For example, to break before all operators
except an B<=> one could use --bbao -wba='=' rather than listing every
single perl operator except B<=> on a -wbb flag.

=back

=head2 Controlling List Formatting

Perltidy attempts to place comma-separated arrays of values in tables
which look good.  Its default algorithms usually work well, and they
have been improving with each release, but several parameters are
available to control list formatting.

=over 4

=item B<-boc>,  B<--break-at-old-comma-breakpoints>

This flag tells perltidy to try to break at all old commas.  This is not
the default.  Normally, perltidy makes a best guess at list formatting,
and seldom uses old comma breakpoints.  Usually this works well,
but consider:

    my @list = (1,
                1, 1,
                1, 2, 1,
                1, 3, 3, 1,
                1, 4, 6, 4, 1,);

The default formatting will flatten this down to one line:

    # perltidy (default)
    my @list = ( 1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 4, 6, 4, 1, );

which hides the structure. Using B<-boc>, plus additional flags
to retain the original style, yields

    # perltidy -boc -lp -pt=2 -vt=1 -vtc=1
    my @list = (1,
                1, 1,
                1, 2, 1,
                1, 3, 3, 1,
                1, 4, 6, 4, 1,);

A disadvantage of this flag is that all tables in the file
must already be nicely formatted.  For another possibility see
the -fs flag in L<Skipping Selected Sections of Code>.

=item B<-mft=n>,  B<--maximum-fields-per-table=n>

If the computed number of fields for any table exceeds B<n>, then it
will be reduced to B<n>.  The default value for B<n> is a large number,
40.  While this value should probably be left unchanged as a general
rule, it might be used on a small section of code to force a list to
have a particular number of fields per line, and then either the B<-boc>
flag could be used to retain this formatting, or a single comment could
be introduced somewhere to freeze the formatting in future applications
of perltidy.

    # perltidy -mft=2
    @month_of_year = (    
        'Jan', 'Feb',
        'Mar', 'Apr',
        'May', 'Jun',
        'Jul', 'Aug',
        'Sep', 'Oct',
        'Nov', 'Dec'
    );

=item B<-cab=n>,  B<--comma-arrow-breakpoints=n>

A comma which follows a comma arrow, '=>', is given special
consideration.  In a long list, it is common to break at all such
commas.  This parameter can be used to control how perltidy breaks at
these commas.  (However, it will have no effect if old comma breaks are
being forced because B<-boc> is used).  The possible values of B<n> are:

 n=0 break at all commas after =>  
 n=1 stable: break at all commas after => if container is open,
     EXCEPT FOR one-line containers
 n=2 break at all commas after =>, BUT try to form the maximum
     maximum one-line container lengths
 n=3 do not treat commas after => specially at all 
 n=4 break everything: like n=0 but ALSO break a short container with
     a => not followed by a comma when -vt=0 is used
 n=5 stable: like n=1 but ALSO break at open one-line containers when
     -vt=0 is used (default)

For example, given the following single line, perltidy by default will
not add any line breaks because it would break the existing one-line
container:

    bless { B => $B, Root => $Root } => $package;

Using B<-cab=0> will force a break after each comma-arrow item:

    # perltidy -cab=0:
    bless {
        B    => $B,
        Root => $Root
    } => $package;

If perltidy is subsequently run with this container broken, then by
default it will break after each '=>' because the container is now
broken.  To reform a one-line container, the parameter B<-cab=2> could
be used.

The flag B<-cab=3> can be used to prevent these commas from being
treated specially.  In this case, an item such as "01" => 31 is
treated as a single item in a table.  The number of fields in this table
will be determined by the same rules that are used for any other table.
Here is an example.
    
    # perltidy -cab=3
    my %last_day = (
        "01" => 31, "02" => 29, "03" => 31, "04" => 30,
        "05" => 31, "06" => 30, "07" => 31, "08" => 31,
        "09" => 30, "10" => 31, "11" => 30, "12" => 31
    );

=back

=head2 Retaining or Ignoring Existing Line Breaks

Several additional parameters are available for controlling the extent
to which line breaks in the input script influence the output script.
In most cases, the default parameter values are set so that, if a choice
is possible, the output style follows the input style.  For example, if
a short logical container is broken in the input script, then the
default behavior is for it to remain broken in the output script.

Most of the parameters in this section would only be required for a
one-time conversion of a script from short container lengths to longer
container lengths.  The opposite effect, of converting long container
lengths to shorter lengths, can be obtained by temporarily using a short
maximum line length.

=over 4

=item B<-bol>,  B<--break-at-old-logical-breakpoints>

By default, if a logical expression is broken at a C<&&>, C<||>, C<and>,
or C<or>, then the container will remain broken.  Also, breaks
at internal keywords C<if> and C<unless> will normally be retained.
To prevent this, and thus form longer lines, use B<-nbol>.

=item B<-bom>,  B<--break-at-old-method-breakpoints>

By default, a method call arrow C<-E<gt>> is considered a candidate for
a breakpoint, but method chains will fill to the line width before a break is
considered.  With B<-bom>, breaks before the arrow are preserved, so if you
have preformatted a method chain:

  my $q = $rs
    ->related_resultset('CDs')
    ->related_resultset('Tracks')
    ->search({
      'track.id' => {-ident => 'none_search.id'},
    })->as_query;

It will B<keep> these breaks, rather than become this:

  my $q = $rs->related_resultset('CDs')->related_resultset('Tracks')->search({
      'track.id' => {-ident => 'none_search.id'},
    })->as_query;

This flag will also look for and keep a 'cuddled' style of calls, 
in which lines begin with a closing paren followed by a call arrow, 
as in this example:

  my $q = $rs->related_resultset(
      'CDs'
  )->related_resultset(
      'Tracks'
  )->search( {
      'track.id' => { -ident => 'none_search.id' },
  } )->as_query;

You may want to include the B<-weld-nested-containers> flag in this case to keep 
nested braces and parens together, as in the last line.


=item B<-bok>,  B<--break-at-old-keyword-breakpoints>

By default, perltidy will retain a breakpoint before keywords which may
return lists, such as C<sort> and <map>.  This allows chains of these
operators to be displayed one per line.  Use B<-nbok> to prevent
retaining these breakpoints.

=item B<-bot>,  B<--break-at-old-ternary-breakpoints>

By default, if a conditional (ternary) operator is broken at a C<:>,
then it will remain broken.  To prevent this, and thereby
form longer lines, use B<-nbot>.

=item B<-boa>,  B<--break-at-old-attribute-breakpoints>

By default, if an attribute list is broken at a C<:> in the source file, then
it will remain broken.  For example, given the following code, the line breaks
at the ':'s will be retained:
       
                    my @field
                      : field
                      : Default(1)
                      : Get('Name' => 'foo') : Set('Name');

If the attributes are on a single line in the source code then they will remain
on a single line if possible.

To prevent this, and thereby always form longer lines, use B<-nboa>.  

=item B<-iob>,  B<--ignore-old-breakpoints>

Use this flag to tell perltidy to ignore existing line breaks to the
maximum extent possible.  This will tend to produce the longest possible
containers, regardless of type, which do not exceed the line length
limit.

=item B<-kis>,  B<--keep-interior-semicolons>

Use the B<-kis> flag to prevent breaking at a semicolon if
there was no break there in the input file.  Normally
perltidy places a newline after each semicolon which
terminates a statement unless several statements are
contained within a one-line brace block.  To illustrate,
consider the following input lines:

    dbmclose(%verb_delim); undef %verb_delim;
    dbmclose(%expanded); undef %expanded;

The default is to break after each statement, giving

    dbmclose(%verb_delim);
    undef %verb_delim;
    dbmclose(%expanded);
    undef %expanded;

With B<perltidy -kis> the multiple statements are retained:

    dbmclose(%verb_delim); undef %verb_delim;
    dbmclose(%expanded);   undef %expanded;

The statements are still subject to the specified value
of B<maximum-line-length> and will be broken if this 
maximum is exceeded.

=back

=head2 Blank Line Control

Blank lines can improve the readability of a script if they are carefully
placed.  Perltidy has several commands for controlling the insertion,
retention, and removal of blank lines.  

=over 4

=item B<-fbl>,  B<--freeze-blank-lines>

Set B<-fbl> if you want to the blank lines in your script to
remain exactly as they are.  The rest of the parameters in
this section may then be ignored.  (Note: setting the B<-fbl> flag
is equivalent to setting B<-mbl=0> and B<-kbl=2>).

=item B<-bbc>,  B<--blanks-before-comments>

A blank line will be introduced before a full-line comment.  This is the
default.  Use B<-nbbc> or  B<--noblanks-before-comments> to prevent
such blank lines from being introduced.

=item B<-blbs=n>,  B<--blank-lines-before-subs=n>

The parameter B<-blbs=n> requests that least B<n> blank lines precede a sub
definition which does not follow a comment and which is more than one-line
long.  The default is <-blbs=1>.  B<BEGIN> and B<END> blocks are included.

The requested number of blanks statement will be inserted regardless of the
value of B<--maximum-consecutive-blank-lines=n> (B<-mbl=n>) with the exception
that if B<-mbl=0> then no blanks will be output.

This parameter interacts with the value B<k> of the parameter B<--maximum-consecutive-blank-lines=k> (B<-mbl=k>) as follows:

1. If B<-mbl=0> then no blanks will be output.  This allows all blanks to be suppressed with a single parameter.  Otherwise,

2. If the number of old blank lines in the script is less than B<n> then
additional blanks will be inserted to make the total B<n> regardless of the
value of B<-mbl=k>.  

3. If the number of old blank lines in the script equals or exceeds B<n> then
this parameter has no effect, however the total will not exceed
value specified on the B<-mbl=k> flag.


=item B<-blbp=n>,  B<--blank-lines-before-packages=n>

The parameter B<-blbp=n> requests that least B<n> blank lines precede a package
which does not follow a comment.  The default is B<-blbp=1>.  

This parameter interacts with the value B<k> of the parameter
B<--maximum-consecutive-blank-lines=k> (B<-mbl=k>) in the same way as described
for the previous item B<-blbs=n>.


=item B<-bbs>,  B<--blanks-before-subs>

For compatibility with previous versions, B<-bbs> or B<--blanks-before-subs>
is equivalent to F<-blbp=1> and F<-blbs=1>.  

Likewise, B<-nbbs> or B<--noblanks-before-subs> 
is equivalent to F<-blbp=0> and F<-blbs=0>.  

=item B<-bbb>,  B<--blanks-before-blocks>

A blank line will be introduced before blocks of coding delimited by
B<for>, B<foreach>, B<while>, B<until>, and B<if>, B<unless>, in the following
circumstances:

=over 4

=item *

The block is not preceded by a comment.

=item *

The block is not a one-line block.

=item *

The number of consecutive non-blank lines at the current indentation depth is at least B<-lbl>
(see next section).

=back

This is the default.  The intention of this option is to introduce
some space within dense coding.
This is negated with B<-nbbb> or  B<--noblanks-before-blocks>.

=item B<-lbl=n> B<--long-block-line-count=n>

This controls how often perltidy is allowed to add blank lines before 
certain block types (see previous section).  The default is 8.  Entering
a value of B<0> is equivalent to entering a very large number.

=item B<-blao=i> or B<--blank-lines-after-opening-block=i>

This control places a minimum of B<i> blank lines B<after> a line which B<ends>
with an opening block brace of a specified type.  By default, this only applies
to the block of a named B<sub>, but this can be changed (see B<-blaol> below).
The default is not to do this (B<i=0>).

Please see the note below on using the B<-blao> and B<-blbc> options.

=item B<-blbc=i> or B<--blank-lines-before-closing-block=i>

This control places a minimum of B<i> blank lines B<before> a line which
B<begins> with a closing block brace of a specified type.  By default, this
only applies to the block of a named B<sub>, but this can be changed (see
B<-blbcl> below).  The default is not to do this (B<i=0>).

=item B<-blaol=s> or B<--blank-lines-after-opening-block-list=s>

The parameter B<s> is a list of block type keywords to which the flag B<-blao>
should apply.  The section L<"Specifying Block Types"> explains how to list
block types.

=item B<-blbcl=s> or B<--blank-lines-before-closing-block-list=s>

This parameter is a list of block type keywords to which the flag B<-blbc>
should apply.  The section L<"Specifying Block Types"> explains how to list
block types.

=item Note on using the B<-blao> and B<-blbc> options.

These blank line controls introduce a certain minimum number of blank lines in
the text, but the final number of blank lines may be greater, depending on
values of the other blank line controls and the number of old blank lines.  A
consequence is that introducing blank lines with these and other controls
cannot be exactly undone, so some experimentation with these controls is
recommended before using them.

For example, suppose that for some reason we decide to introduce one blank
space at the beginning and ending of all blocks.  We could do
this using

  perltidy -blao=2 -blbc=2 -blaol='*' -blbcl='*' filename

Now suppose the script continues to be developed, but at some later date we
decide we don't want these spaces after all. we might expect that running with
the flags B<-blao=0> and B<-blbc=0> will undo them.  However, by default
perltidy retains single blank lines, so the blank lines remain.  

We can easily fix this by telling perltidy to ignore old blank lines by
including the added parameter B<-kbl=0> and rerunning. Then the unwanted blank
lines will be gone.  However, this will cause all old blank lines to be
ignored, perhaps even some that were added by hand to improve formatting. So
please be cautious when using these parameters.

=item B<-mbl=n> B<--maximum-consecutive-blank-lines=n>   

This parameter specifies the maximum number of consecutive blank lines which
will be output within code sections of a script.  The default is n=1.  If the
input file has more than n consecutive blank lines, the number will be reduced
to n except as noted above for the B<-blbp> and B<-blbs> parameters.  If B<n=0>
then no blank lines will be output (unless all old blank lines are retained
with the B<-kbl=2> flag of the next section).

This flag obviously does not apply to pod sections,
here-documents, and quotes.  

=item B<-kbl=n>,  B<--keep-old-blank-lines=n>

The B<-kbl=n> flag gives you control over how your existing blank lines are
treated.  

The possible values of B<n> are:

 n=0 ignore all old blank lines
 n=1 stable: keep old blanks, but limited by the value of the B<-mbl=n> flag
 n=2 keep all old blank lines, regardless of the value of the B<-mbl=n> flag

The default is B<n=1>.  

=item B<-sob>,  B<--swallow-optional-blank-lines>

This is equivalent to B<kbl=0> and is included for compatibility with
previous versions.

=item B<-nsob>,  B<--noswallow-optional-blank-lines>

This is equivalent to B<kbl=1> and is included for compatibility with
previous versions.

=back

B<Controls for blank lines around lines of consecutive keywords>

The parameters in this section provide some control over the placement of blank
lines within and around groups of statements beginning with selected keywords.
These blank lines are called here B<keyword group blanks>, and all of the
parameters begin with B<--keyword-group-blanks*>, or B<-kgb*> for short.  The
default settings do not employ these controls but they can be enabled with the
following parameters:

B<-kgbl=s> or B<--keyword-group-blanks-list=s>; B<s> is a quoted string of keywords

B<-kgbs=s> or B<--keyword-group-blanks-size=s>; B<s> gives the number of keywords required to form a group.  

B<-kgbb=n> or B<--keyword-group-blanks-before=n>; B<n> = (0, 1, or 2) controls a leading blank

B<-kgba=n> or B<--keyword-group-blanks-after=n>; B<n> = (0, 1, or 2) controls a trailing blank

B<-kgbi> or B<--keyword-group-blanks-inside> is a switch for adding blanks between subgroups

B<-kgbd> or B<--keyword-group-blanks-delete> is a switch for removing initial blank lines between keywords

B<-kgbr=n> or B<--keyword-group-blanks-repeat-count=n> can limit the number of times this logic is applied

In addition, the following abbreviations are available to for simplified usage:

B<-kgb> or B<--keyword-group-blanks> is short for B<-kgbb=2 -kgba=2 kgbi>

B<-nkgb> or B<--nokeyword-group-blanks>, is short for B<-kgbb=1 -kgba=1 nkgbi>

Before describing the meaning of the parameters in detail let us look at an
example which is formatted with default parameter settings.

        print "Entering test 2\n";
        use Test;
        use Encode qw(from_to encode decode
          encode_utf8 decode_utf8
          find_encoding is_utf8);
        use charnames qw(greek);
        my @encodings     = grep( /iso-?8859/, Encode::encodings() );
        my @character_set = ( '0' .. '9', 'A' .. 'Z', 'a' .. 'z' );
        my @source        = qw(ascii iso8859-1 cp1250);
        my @destiny       = qw(cp1047 cp37 posix-bc);
        my @ebcdic_sets   = qw(cp1047 cp37 posix-bc);
        my $str           = join( '', map( chr($_), 0x20 .. 0x7E ) );
        return unless ($str);

using B<perltidy -kgb> gives:

        print "Entering test 2\n";
                                      <----------this blank controlled by -kgbb
        use Test;
        use Encode qw(from_to encode decode
          encode_utf8 decode_utf8
          find_encoding is_utf8);
        use charnames qw(greek);
                                      <---------this blank controlled by -kgbi
        my @encodings     = grep( /iso-?8859/, Encode::encodings() );
        my @character_set = ( '0' .. '9', 'A' .. 'Z', 'a' .. 'z' );
        my @source        = qw(ascii iso8859-1 cp1250);
        my @destiny       = qw(cp1047 cp37 posix-bc);
        my @ebcdic_sets   = qw(cp1047 cp37 posix-bc);
        my $str           = join( '', map( chr($_), 0x20 .. 0x7E ) );
                                      <----------this blank controlled by -kgba
        return unless ($str);

Blank lines have been introduced around the B<my> and B<use> sequences.  What
happened is that the default keyword list includes B<my> and B<use> but not
B<print> and B<return>.  So a continuous sequence of nine B<my> and B<use>
statements was located.  This number exceeds the default threshold of five, so
blanks were placed before and after the entire group.  Then, since there was
also a subsequence of six B<my> lines, a blank line was introduced to separate
them.

Finer control over blank placement can be achieved by using the individual
parameters rather than the B<-kgb> flag.  The individual controls are as follows.

B<-kgbl=s> or B<--keyword-group-blanks-list=s>, where B<s> is a quoted string,
defines the set of keywords which will be formed into groups.  The string is a
space separated list of keywords.  The default set is B<s="use require local
our my">, but any list of keywords may be used. Comment lines may also be included in a keyword group, even though they are not keywords.  To include ordinary block comments, include the symbol B<BC>. To include static block comments (which normally begin with '##'), include the symbol B<SBC>.

B<-kgbs=s> or B<--keyword-group-blanks-size=s>, where B<s> is a string
describing the number of consecutive keyword statements forming a group.  If
B<s> is an integer then it is the minimum number required for a group.  A
maximum value may also be given with the format B<s=min.max>, where B<min> is
the minimum number and B<max> is the maximum number, and the min and max values
are separated by one or more dots.  No groups will be found if the maximum is
less than the minimum.  The maximum is unlimited if not given.  The default is
B<s=5>.  Some examples:

    s      min   max         number for group
    3      3     unlimited   3 or more
    1.1    1     1           1
    1..3   1     3           1 to 3
    1.0    1     0           (no match)
    

B<-kgbb=n> or B<--keyword-group-blanks-before=n> specifies whether
a blank should appear before the first line of the group, as follows:

   n=0 => (delete) an existing blank line will be removed
   n=1 => (stable) no change to the input file is made  [DEFAULT]
   n=2 => (insert) a blank line is introduced if possible

B<-kgba=n> or B<--keyword-group-blanks-after=n> likewise specifies
whether a blank should appear after the last line of the group, using the same
scheme (0=delete, 1=stable, 2=insert).

B<-kgbi> or B<--keyword-group-blanks-inside> controls
the insertion of blank lines between the first and last statement of the entire
group.  If there is a continuous run of a single statement type with more than
the minimum threshold number (as specified with B<-kgbs=s>) then this
switch causes a blank line be inserted between this
subgroup and the others. In the example above this happened between the
B<use> and B<my> statements.

B<-kgbd> or B<--keyword-group-blanks-delete> controls the deletion of any
blank lines that exist in the the group when it is first scanned.  When
statements are initially scanned, any existing blank lines are included in the
collection.  Any such orignial blank lines will be deleted before any other
insertions are made when the parameter B<-kgbd> is set.  The default is not to
do this, B<-nkgbd>.  

B<-kgbr=n> or B<--keyword-group-blanks-repeat-count=n> specifies B<n>, the
maximum number of times this logic will be applied to any file.  The special
value B<n=0> is the same as n=infinity which means it will be applied to an
entire script [Default].  A value B<n=1> could be used to make it apply just
one time for example.  This might be useful for adjusting just the B<use>
statements in the top part of a module for example.

B<-kgb> or B<--keyword-group-blanks> is an abbreviation equivalent to setting
B<-kgbb=1 -kgba=1 -kgbi>.  This turns on keyword group formatting with a set of
default values.  

B<-nkgb> or B<--nokeyword-group-blanks> is equivalent to B<-kgbb=0 -kgba
nkgbi>.  This flag turns off keyword group blank lines and is the default
setting. 

Here are a few notes about the functioning of this technique.  

=over 4

=item *

These parameters are probably more useful as part of a major code reformatting
operation rather than as a routine formatting operation.

In particular, note that deleting old blank lines with B<-kgbd> is an
irreversible operation so it should be applied with care.  Existing blank lines
may be serving an important role in controlling vertical alignment.

=item *

Conflicts which arise among these B<kgb*> parameters and other blank line
controls are generally resolved by producing the maximum number of blank lines
implied by any parameter.

For example, if the flags B<--freeze-blank-lines>, or
B<--keep-old-blank-lines=2>, are set, then they have priority over any blank
line deletion implied by the B<-kgb> flags of this section, so no blank lines
will be deleted.

For another example, if a keyword group ends at a B<sub> and the flag B<kgba=0> requests no blank line there, but we also have B<--blank-lines-before-subs=2>, then two blank lines will still be introduced before the sub.

=item *

The introduction of blank lines does not occur if it would conflict with other
input controls or code validity. For example, a blank line will not be placed
within a here-doc or within a section of code marked with format skipping
comments.  And in general, a blank line will only be introduced at the end of a
group if the next statement is a line of code. 

=item *

The count which is used to determine the group size is not the number of lines
but rather the total number of keywords which are found.  Individual statements
with a certain leading keyword may continue on multiple lines, but if any of
these lines is nested more than one level deep then that group will be ended.

=item *

The search for groups of lines with similar leading keywords is based on the
input source, not the final formatted source.  Consequently, if the source code
is badly formatted, it would be best to make a first formatting pass without
these options.

=back

=head2 Styles

A style refers to a convenient collection of existing parameters.

=over 4

=item B<-gnu>, B<--gnu-style>

B<-gnu> gives an approximation to the GNU Coding Standards (which do
not apply to perl) as they are sometimes implemented.  At present, this
style overrides the default style with the following parameters:

    -lp -bl -noll -pt=2 -bt=2 -sbt=2 -icp

=item B<-pbp>, B<--perl-best-practices>

B<-pbp> is an abbreviation for the parameters in the book B<Perl Best Practices>
by Damian Conway:

    -l=78 -i=4 -ci=4 -st -se -vt=2 -cti=0 -pt=1 -bt=1 -sbt=1 -bbt=1 -nsfs -nolq
    -wbb="% + - * / x != == >= <= =~ !~ < > | & = 
          **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x="

Please note that this parameter set includes -st and -se flags, which make
perltidy act as a filter on one file only.  These can be overridden by placing
B<-nst> and/or B<-nse> after the -pbp parameter. 

Also note that the value of continuation indentation, -ci=4, is equal to the
value of the full indentation, -i=4.  In some complex statements perltidy will
produce nicer results with -ci=2. This can be implemented by including -ci=2
after the -pbp parameter.  For example, 

    # perltidy -pbp
    $self->{_text} = (
         !$section        ? ''
        : $type eq 'item' ? "the $section entry"
        :                   "the section on $section"
        )
        . (
        $page
        ? ( $section ? ' in ' : '' ) . "the $page$page_ext manpage"
        : ' elsewhere in this document'
        );

    # perltidy -pbp -ci=2
    $self->{_text} = (
         !$section        ? ''
        : $type eq 'item' ? "the $section entry"
        :                   "the section on $section"
      )
      . (
        $page
        ? ( $section ? ' in ' : '' ) . "the $page$page_ext manpage"
        : ' elsewhere in this document'
      );


=item  One-line blocks 

There are a few points to note regarding one-line blocks.  A one-line
block is something like this,

	if ($x > 0) { $y = 1 / $x }  

where the contents within the curly braces is short enough to fit
on a single line.

With few exceptions, perltidy retains existing one-line blocks, if it
is possible within the line-length constraint, but it does not attempt
to form new ones.  In other words, perltidy will try to follow the
one-line block style of the input file.

If an existing one-line block is longer than the maximum line length,
however, it will be broken into multiple lines.  When this happens, perltidy
checks for and adds any optional terminating semicolon (unless the B<-nasc>
option is used) if the block is a code block.  

The main exception is that perltidy will attempt to form new one-line
blocks following the keywords C<map>, C<eval>, and C<sort>, because
these code blocks are often small and most clearly displayed in a single
line.

One-line block rules can conflict with the cuddled-else option.  When
the cuddled-else option is used, perltidy retains existing one-line
blocks, even if they do not obey cuddled-else formatting.

Occasionally, when one-line blocks get broken because they exceed the
available line length, the formatting will violate the requested brace style.
If this happens, reformatting the script a second time should correct
the problem.

Sometimes it might be desirable to convert a script to have one-line blocks
whenever possible.  Although there is currently no flag for this, a simple
workaround is to execute perltidy twice, once with the flag B<-noadd-newlines>
and then once again with normal parameters, like this:  

     cat infile | perltidy -nanl | perltidy >outfile

When executed on this snippet

    if ( $? == -1 ) {
        die "failed to execute: $!\n";
    }
    if ( $? == -1 ) {
        print "Had enough.\n";
        die "failed to execute: $!\n";
    }

the result is

    if ( $? == -1 ) { die "failed to execute: $!\n"; }
    if ( $? == -1 ) {
        print "Had enough.\n";
        die "failed to execute: $!\n";
    }

This shows that blocks with a single statement become one-line blocks.

=item B<-olbs=n>, B<--one-line-block-semicolons=n>

This flag controls the placement of semicolons at the end of one-line blocks.
Semicolons are optional before a closing block brace, and frequently they are
omitted at the end of a one-line block containing just a single statement.
By default, perltidy follows the input file regarding these semicolons, 
but this behavior can be controlled by this flag.  The values of n are:

  n=0 remove terminal semicolons in one-line blocks having a single statement
  n=1 stable; keep input file placement of terminal semicolons [DEFAULT ]
  n=2 add terminal semicolons in all one-line blocks

Note that the B<n=2> option has no effect if adding semicolons is prohibited
with the B<-nasc> flag.  Also not that while B<n=2> adds missing semicolons to
all one-line blocks, regardless of complexity, the B<n=0> option only removes
ending semicolons which terminate one-line blocks containing just one
semicolon.  So these two options are not exact inverses.

=item B<-olbn=n>, B<--one-line-block-nesting=n>

Nested one-line blocks are lines with code blocks which themselves contain code
blocks.  For example, the following line is a nested one-line block.

         foreach (@list) { if ($_ eq $asked_for) { last } ++$found }

The default behavior is to break such lines into multiple lines, but this
behavior can be controlled with this flag.  The values of n are:

  n=0 break nested one-line blocks into multiple lines [DEFAULT]
  n=1 stable: keep existing nested-one line blocks intact

For the above example, the default formatting (B<-olbn=0>) is

    foreach (@list) {
        if ( $_ eq $asked_for ) { last }
        ++$found;
    }

If the parameter B<-olbn=1> is given, then the line will be left intact if it
is a single line in the source, or it will be broken into multiple lines if it 
is broken in multiple lines in the source.


=back


=head2 Controlling Vertical Alignment

Vertical alignment refers to lining up certain symbols in list of consecutive
similar lines to improve readability.  For example, the "fat commas" are
aligned in the following statement:

        $data = $pkg->new(
            PeerAddr => join( ".", @port[ 0 .. 3 ] ),   
            PeerPort => $port[4] * 256 + $port[5],
            Proto    => 'tcp'
        );

The only explicit control on vertical alignment is to turn it off using
B<-novalign>, a flag mainly intended for debugging.  However, vertical
alignment can be forced to stop and restart by selectively introducing blank
lines.  For example, a blank has been inserted in the following code
to keep somewhat similar things aligned.

    %option_range = (
        'format'             => [ 'tidy', 'html', 'user' ],
        'output-line-ending' => [ 'dos',  'win',  'mac', 'unix' ],
        'character-encoding' => [ 'none', 'utf8' ],

        'block-brace-tightness'    => [ 0, 2 ],
        'brace-tightness'          => [ 0, 2 ],
        'paren-tightness'          => [ 0, 2 ],
        'square-bracket-tightness' => [ 0, 2 ],
    );


=head2 Other Controls

=over 4

=item Deleting selected text 

Perltidy can selectively delete comments and/or pod documentation.  The
command B<-dac> or  B<--delete-all-comments> will delete all comments
B<and> all pod documentation, leaving just code and any leading system
control lines.

The command B<-dp> or B<--delete-pod> will remove all pod documentation
(but not comments).

Two commands which remove comments (but not pod) are: B<-dbc> or
B<--delete-block-comments> and B<-dsc> or  B<--delete-side-comments>.
(Hanging side comments will be deleted with block comments here.)

The negatives of these commands also work, and are the defaults.  When
block comments are deleted, any leading 'hash-bang' will be retained.
Also, if the B<-x> flag is used, any system commands before a leading
hash-bang will be retained (even if they are in the form of comments).

=item Writing selected text to a file

When perltidy writes a formatted text file, it has the ability to also
send selected text to a file with a F<.TEE> extension.  This text can
include comments and pod documentation.  

The command B<-tac> or  B<--tee-all-comments> will write all comments
B<and> all pod documentation.

The command B<-tp> or B<--tee-pod> will write all pod documentation (but
not comments).

The commands which write comments (but not pod) are: B<-tbc> or
B<--tee-block-comments> and B<-tsc> or  B<--tee-side-comments>.
(Hanging side comments will be written with block comments here.)

The negatives of these commands also work, and are the defaults.  

=item Using a F<.perltidyrc> command file

If you use perltidy frequently, you probably won't be happy until you
create a F<.perltidyrc> file to avoid typing commonly-used parameters.
Perltidy will first look in your current directory for a command file
named F<.perltidyrc>.  If it does not find one, it will continue looking
for one in other standard locations.  

These other locations are system-dependent, and may be displayed with
the command C<perltidy -dpro>.  Under Unix systems, it will first look
for an environment variable B<PERLTIDY>.  Then it will look for a
F<.perltidyrc> file in the home directory, and then for a system-wide
file F</usr/local/etc/perltidyrc>, and then it will look for
F</etc/perltidyrc>.  Note that these last two system-wide files do not
have a leading dot.  Further system-dependent information will be found
in the INSTALL file distributed with perltidy.

Under Windows, perltidy will also search for a configuration file named perltidy.ini since Windows does not allow files with a leading period (.).
Use C<perltidy -dpro> to see the possible locations for your system.
An example might be F<C:\Documents and Settings\All Users\perltidy.ini>.

Another option is the use of the PERLTIDY environment variable.
The method for setting environment variables depends upon the version of
Windows that you are using.  Instructions for Windows 95 and later versions can
be found here:

http://www.netmanage.com/000/20021101_005_tcm21-6336.pdf

Under Windows NT / 2000 / XP the PERLTIDY environment variable can be placed in
either the user section or the system section.  The later makes the
configuration file common to all users on the machine.  Be sure to enter the
full path of the configuration file in the value of the environment variable.
Ex.  PERLTIDY=C:\Documents and Settings\perltidy.ini

The configuration file is free format, and simply a list of parameters, just as
they would be entered on a command line.  Any number of lines may be used, with
any number of parameters per line, although it may be easiest to read with one
parameter per line.  Comment text begins with a #, and there must
also be a space before the # for side comments.  It is a good idea to
put complex parameters in either single or double quotes.

Here is an example of a F<.perltidyrc> file:

  # This is a simple of a .perltidyrc configuration file
  # This implements a highly spaced style
  -se    # errors to standard error output
  -w     # show all warnings
  -bl	 # braces on new lines
  -pt=0  # parens not tight at all
  -bt=0  # braces not tight
  -sbt=0 # square brackets not tight

The parameters in the F<.perltidyrc> file are installed first, so any
parameters given on the command line will have priority over them.  

To avoid confusion, perltidy ignores any command in the .perltidyrc
file which would cause some kind of dump and an exit.  These are:

 -h -v -ddf -dln -dop -dsn -dtt -dwls -dwrs -ss

There are several options may be helpful in debugging a F<.perltidyrc>
file:  

=over 4

=item *

A very helpful command is B<--dump-profile> or B<-dpro>.  It writes a
list of all configuration filenames tested to standard output, and 
if a file is found, it dumps the content to standard output before
exiting.  So, to find out where perltidy looks for its configuration
files, and which one if any it selects, just enter 

  perltidy -dpro

=item *

It may be simplest to develop and test configuration files with
alternative names, and invoke them with B<-pro=filename> on the command
line.  Then rename the desired file to F<.perltidyrc> when finished.

=item *

The parameters in the F<.perltidyrc> file can be switched off with 
the B<-npro> option.

=item *

The commands B<--dump-options>, B<--dump-defaults>, B<--dump-long-names>,
and B<--dump-short-names>, all described below, may all be helpful.

=back

=item Creating a new abbreviation

A special notation is available for use in a F<.perltidyrc> file
for creating an abbreviation for a group
of options.  This can be used to create a
shorthand for one or more styles which are frequently, but not always,
used.  The notation is to group the options within curly braces which
are preceded by the name of the alias (without leading dashes), like this:

	newword {
	-opt1
	-opt2
	}

where B<newword> is the abbreviation, and B<opt1>, etc, are existing parameters
I<or other abbreviations>.  The main syntax requirement is that the new
abbreviation along with its opening curly brace must begin on a new line.
Space before and after the curly braces is optional.
For a
specific example, the following line

	airy {-bl -pt=0 -bt=0 -sbt=0}

could be placed in a F<.perltidyrc> file, and then invoked at will with

	perltidy -airy somefile.pl

(Either C<-airy> or C<--airy> may be used).

=item Skipping leading non-perl commands with B<-x> or B<--look-for-hash-bang>

If your script has leading lines of system commands or other text which
are not valid perl code, and which are separated from the start of the
perl code by a "hash-bang" line, ( a line of the form C<#!...perl> ),
you must use the B<-x> flag to tell perltidy not to parse and format any
lines before the "hash-bang" line.  This option also invokes perl with a
-x flag when checking the syntax.  This option was originally added to
allow perltidy to parse interactive VMS scripts, but it should be used
for any script which is normally invoked with C<perl -x>.

=item  Making a file unreadable

The goal of perltidy is to improve the readability of files, but there
are two commands which have the opposite effect, B<--mangle> and
B<--extrude>.  They are actually
merely aliases for combinations of other parameters.  Both of these
strip all possible whitespace, but leave comments and pod documents,
so that they are essentially reversible.  The
difference between these is that B<--mangle> puts the fewest possible
line breaks in a script while B<--extrude> puts the maximum possible.
Note that these options do not provided any meaningful obfuscation, because
perltidy can be used to reformat the files.  They were originally
developed to help test the tokenization logic of perltidy, but they
have other uses.
One use for B<--mangle> is the following:

  perltidy --mangle myfile.pl -st | perltidy -o myfile.pl.new

This will form the maximum possible number of one-line blocks (see next
section), and can sometimes help clean up a badly formatted script.

A similar technique can be used with B<--extrude> instead of B<--mangle>
to make the minimum number of one-line blocks.

Another use for B<--mangle> is to combine it with B<-dac> to reduce
the file size of a perl script.

=item  Debugging 

The following flags are available for debugging:

B<--dump-cuddled-block-list> or B<-dcbl> will dump to standard output the
internal hash of cuddled block types created by a B<-cuddled-block-list> input
string.

B<--dump-defaults> or B<-ddf> will write the default option set to standard output and quit

B<--dump-profile> or B<-dpro>  will write the name of the current 
configuration file and its contents to standard output and quit.

B<--dump-options> or B<-dop>  will write current option set to standard
output and quit.  

B<--dump-long-names> or B<-dln>  will write all command line long names (passed 
to Get_options) to standard output and quit.

B<--dump-short-names>  or B<-dsn> will write all command line short names 
to standard output and quit.

B<--dump-token-types> or B<-dtt>  will write a list of all token types 
to standard output and quit.

B<--dump-want-left-space> or B<-dwls>  will write the hash %want_left_space
to standard output and quit.  See the section on controlling whitespace
around tokens.

B<--dump-want-right-space> or B<-dwrs>  will write the hash %want_right_space
to standard output and quit.  See the section on controlling whitespace
around tokens.

B<--no-memoize> or B<-nmem>  will turn of memoizing.
Memoization can reduce run time when running perltidy repeatedly in a 
single process.  It is on by default but can be deactivated for
testing with B<-nmem>.

B<--no-timestamp> or B<-nts> will eliminate any time stamps in output files to prevent
differences in dates from causing test installation scripts to fail. There are just
a couple of places where timestamps normally occur. One is in the headers of
html files, and another is when the B<-cscw> option is selected. The default is
to allow timestamps (B<--timestamp> or B<-ts>).

B<--file-size-order> or B<-fso> will cause files to be processed in order of
increasing size, when multiple files are being processed.  This is useful
during program development, when large numbers of files with varying sizes are
processed, because it can reduce virtual memory usage. 

B<-DEBUG>  will write a file with extension F<.DEBUG> for each input file 
showing the tokenization of all lines of code.

=item Working with MakeMaker, AutoLoader and SelfLoader

The first $VERSION line of a file which might be eval'd by MakeMaker
is passed through unchanged except for indentation.  
Use B<--nopass-version-line>, or B<-npvl>, to deactivate this feature.

If the AutoLoader module is used, perltidy will continue formatting
code after seeing an __END__ line.
Use B<--nolook-for-autoloader>, or B<-nlal>, to deactivate this feature.

Likewise, if the SelfLoader module is used, perltidy will continue formatting
code after seeing a __DATA__ line.
Use B<--nolook-for-selfloader>, or B<-nlsl>, to deactivate this feature.

=item Working around problems with older version of Perl 

Perltidy contains a number of rules which help avoid known subtleties
and problems with older versions of perl, and these rules always
take priority over whatever formatting flags have been set.  For example,
perltidy will usually avoid starting a new line with a bareword, because
this might cause problems if C<use strict> is active.

There is no way to override these rules.

=back

=head1 HTML OPTIONS

=over 4

=item  The B<-html> master switch

The flag B<-html> causes perltidy to write an html file with extension
F<.html>.  So, for example, the following command

	perltidy -html somefile.pl

will produce a syntax-colored html file named F<somefile.pl.html>
which may be viewed with a browser.

B<Please Note>: In this case, perltidy does not do any formatting to the
input file, and it does not write a formatted file with extension
F<.tdy>.  This means that two perltidy runs are required to create a
fully reformatted, html copy of a script.  

=item  The B<-pre> flag for code snippets

When the B<-pre> flag is given, only the pre-formatted section, within
the <PRE> and </PRE> tags, will be output.  This simplifies inclusion
of the output in other files.  The default is to output a complete
web page.

=item  The B<-nnn> flag for line numbering

When the B<-nnn> flag is given, the output lines will be numbered.

=item  The B<-toc>, or B<--html-table-of-contents> flag

By default, a table of contents to packages and subroutines will be
written at the start of html output.  Use B<-ntoc> to prevent this.
This might be useful, for example, for a pod document which contains a
number of unrelated code snippets.  This flag only influences the code
table of contents; it has no effect on any table of contents produced by
pod2html (see next item).

=item  The B<-pod>, or B<--pod2html> flag

There are two options for formatting pod documentation.  The default is
to pass the pod through the Pod::Html module (which forms the basis of
the pod2html utility).  Any code sections are formatted by perltidy, and
the results then merged.  Note: perltidy creates a temporary file when
Pod::Html is used; see L<"FILES">.  Also, Pod::Html creates temporary
files for its cache.

NOTE: Perltidy counts the number of C<=cut> lines, and either moves the
pod text to the top of the html file if there is one C<=cut>, or leaves
the pod text in its original order (interleaved with code) otherwise.

Most of the flags accepted by pod2html may be included in the perltidy
command line, and they will be passed to pod2html.  In some cases,
the flags have a prefix C<pod> to emphasize that they are for the
pod2html, and this prefix will be removed before they are passed to
pod2html.  The flags which have the additional C<pod> prefix are:

   --[no]podheader --[no]podindex --[no]podrecurse --[no]podquiet 
   --[no]podverbose --podflush

The flags which are unchanged from their use in pod2html are:

   --backlink=s --cachedir=s --htmlroot=s --libpods=s --title=s
   --podpath=s --podroot=s 

where 's' is an appropriate character string.  Not all of these flags are
available in older versions of Pod::Html.  See your Pod::Html documentation for
more information.

The alternative, indicated with B<-npod>, is not to use Pod::Html, but
rather to format pod text in italics (or whatever the stylesheet
indicates), without special html markup.  This is useful, for example,
if pod is being used as an alternative way to write comments.

=item  The B<-frm>, or B<--frames> flag

By default, a single html output file is produced.  This can be changed
with the B<-frm> option, which creates a frame holding a table of
contents in the left panel and the source code in the right side. This
simplifies code browsing.  Assume, for example, that the input file is
F<MyModule.pm>.  Then, for default file extension choices, these three
files will be created:

 MyModule.pm.html      - the frame
 MyModule.pm.toc.html  - the table of contents
 MyModule.pm.src.html  - the formatted source code

Obviously this file naming scheme requires that output be directed to a real
file (as opposed to, say, standard output).  If this is not the
case, or if the file extension is unknown, the B<-frm> option will be
ignored.

=item  The B<-text=s>, or B<--html-toc-extension> flag

Use this flag to specify the extra file extension of the table of contents file
when html frames are used.  The default is "toc".
See L<Specifying File Extensions>.

=item  The B<-sext=s>, or B<--html-src-extension> flag

Use this flag to specify the extra file extension of the content file when html
frames are used.  The default is "src".
See L<Specifying File Extensions>.

=item  The B<-hent>, or B<--html-entities> flag

This flag controls the use of Html::Entities for html formatting.  By
default, the module Html::Entities is used to encode special symbols.
This may not be the right thing for some browser/language
combinations.  Use --nohtml-entities or -nhent to prevent this.

=item  Style Sheets

Style sheets make it very convenient to control and adjust the
appearance of html pages.  The default behavior is to write a page of
html with an embedded style sheet.

An alternative to an embedded style sheet is to create a page with a
link to an external style sheet.  This is indicated with the
B<-css=filename>,  where the external style sheet is F<filename>.  The
external style sheet F<filename> will be created if and only if it does
not exist.  This option is useful for controlling multiple pages from a
single style sheet.

To cause perltidy to write a style sheet to standard output and exit,
use the B<-ss>, or B<--stylesheet>, flag.  This is useful if the style
sheet could not be written for some reason, such as if the B<-pre> flag
was used.  Thus, for example,
  
  perltidy -html -ss >mystyle.css

will write a style sheet with the default properties to file
F<mystyle.css>.

The use of style sheets is encouraged, but a web page without a style
sheets can be created with the flag B<-nss>.  Use this option if you
must to be sure that older browsers (roughly speaking, versions prior to
4.0 of Netscape Navigator and Internet Explorer) can display the
syntax-coloring of the html files.

=item  Controlling HTML properties

Note: It is usually more convenient to accept the default properties
and then edit the stylesheet which is produced.  However, this section
shows how to control the properties with flags to perltidy.

Syntax colors may be changed from their default values by flags of the either
the long form, B<-html-color-xxxxxx=n>, or more conveniently the short form,
B<-hcx=n>, where B<xxxxxx> is one of the following words, and B<x> is the
corresponding abbreviation:

      Token Type             xxxxxx           x 
      ----------             --------         --
      comment                comment          c
      number                 numeric          n
      identifier             identifier       i
      bareword, function     bareword         w
      keyword                keyword          k
      quite, pattern         quote            q
      here doc text          here-doc-text    h
      here doc target        here-doc-target  hh
      punctuation            punctuation      pu
      parentheses            paren            p
      structural braces      structure        s
      semicolon              semicolon        sc
      colon                  colon            co
      comma                  comma            cm
      label                  label            j
      sub definition name    subroutine       m
      pod text               pod-text         pd

A default set of colors has been defined, but they may be changed by providing
values to any of the following parameters, where B<n> is either a 6 digit 
hex RGB color value or an ascii name for a color, such as 'red'.

To illustrate, the following command will produce an html 
file F<somefile.pl.html> with "aqua" keywords:

	perltidy -html -hck=00ffff somefile.pl

and this should be equivalent for most browsers:

	perltidy -html -hck=aqua somefile.pl

Perltidy merely writes any non-hex names that it sees in the html file.
The following 16 color names are defined in the HTML 3.2 standard:

	black   => 000000,
	silver  => c0c0c0,
	gray    => 808080,
	white   => ffffff,
	maroon  => 800000,
	red     => ff0000,
	purple  => 800080,
	fuchsia => ff00ff,
	green   => 008000,
	lime    => 00ff00,
	olive   => 808000,
	yellow  => ffff00
	navy    => 000080,
	blue    => 0000ff,
	teal    => 008080,
	aqua    => 00ffff,

Many more names are supported in specific browsers, but it is safest
to use the hex codes for other colors.  Helpful color tables can be
located with an internet search for "HTML color tables". 

Besides color, two other character attributes may be set: bold, and italics.
To set a token type to use bold, use the flag
B<--html-bold-xxxxxx> or B<-hbx>, where B<xxxxxx> or B<x> are the long
or short names from the above table.  Conversely, to set a token type to 
NOT use bold, use B<--nohtml-bold-xxxxxx> or B<-nhbx>.

Likewise, to set a token type to use an italic font, use the flag
B<--html-italic-xxxxxx> or B<-hix>, where again B<xxxxxx> or B<x> are the
long or short names from the above table.  And to set a token type to
NOT use italics, use B<--nohtml-italic-xxxxxx> or B<-nhix>.

For example, to use bold braces and lime color, non-bold, italics keywords the
following command would be used:

	perltidy -html -hbs -hck=00FF00 -nhbk -hik somefile.pl

The background color can be specified with B<--html-color-background=n>,
or B<-hcbg=n> for short, where n is a 6 character hex RGB value.  The
default color of text is the value given to B<punctuation>, which is
black as a default.

Here are some notes and hints:

1. If you find a preferred set of these parameters, you may want
to create a F<.perltidyrc> file containing them.  See the perltidy man
page for an explanation.

2. Rather than specifying values for these parameters, it is probably
easier to accept the defaults and then edit a style sheet.  The style
sheet contains comments which should make this easy.

3. The syntax-colored html files can be very large, so it may be best to
split large files into smaller pieces to improve download times.

=back

=head1 SOME COMMON INPUT CONVENTIONS

=head2 Specifying Block Types

Several parameters which refer to code block types may be customized by also
specifying an associated list of block types.  The type of a block is the name
of the keyword which introduces that block, such as B<if>, B<else>, or B<sub>.
An exception is a labeled block, which has no keyword, and should be specified
with just a colon.  To specify all blocks use B<'*'>.

The keyword B<sub> indicates a named sub.  For anonymous subs, use the special
keyword B<asub>.

For example, the following parameter specifies C<sub>, labels, C<BEGIN>, and
C<END> blocks:

   -cscl="sub : BEGIN END"

(the meaning of the -cscl parameter is described above.)  Note that
quotes are required around the list of block types because of the
spaces.  For another example, the following list specifies all block types
for vertical tightness:

   -bbvtl='*'

=head2 Specifying File Extensions

Several parameters allow default file extensions to be overridden.  For
example, a backup file extension may be specified with B<-bext=ext>,
where B<ext> is some new extension.  In order to provides the user some
flexibility, the following convention is used in all cases to decide if
a leading '.' should be used.  If the extension C<ext> begins with
C<A-Z>, C<a-z>, or C<0-9>, then it will be appended to the filename with
an intermediate '.' (or perhaps a '_' on VMS systems).  Otherwise, it
will be appended directly.  

For example, suppose the file is F<somefile.pl>.  For C<-bext=old>, a '.' is
added to give F<somefile.pl.old>.  For C<-bext=.old>, no additional '.' is
added, so again the backup file is F<somefile.pl.old>.  For C<-bext=~>, then no
dot is added, and the backup file will be F<somefile.pl~>  .  

=head1 SWITCHES WHICH MAY BE NEGATED

The following list shows all short parameter names which allow a prefix
'n' to produce the negated form:

 D    anl asc  aws  b    bbb bbc bbs  bl   bli  boc bok  bol  bot  ce
 csc  dac dbc  dcsc ddf  dln dnl dop  dp   dpro dsc dsm  dsn  dtt  dwls
 dwrs dws f    fll  frm  fs  hsc html ibc  icb  icp iob  isbc lal  log
 lp   lsl ohbr okw  ola  oll opr opt  osbr otr  ple  pod  pvl  q
 sbc  sbl schb scp  scsb sct se  sfp  sfs  skp  sob sohb sop  sosb sot
 ssc  st  sts  syn  t    tac tbc toc  tp   tqw  tsc w    x    bar  kis

Equivalently, the prefix 'no' or 'no-' on the corresponding long names may be
used.

=head1 LIMITATIONS

=over 4

=item  Parsing Limitations

Perltidy should work properly on most perl scripts.  It does a lot of
self-checking, but still, it is possible that an error could be
introduced and go undetected.  Therefore, it is essential to make
careful backups and to test reformatted scripts.

The main current limitation is that perltidy does not scan modules
included with 'use' statements.  This makes it necessary to guess the
context of any bare words introduced by such modules.  Perltidy has good
guessing algorithms, but they are not infallible.  When it must guess,
it leaves a message in the log file.

If you encounter a bug, please report it.

=item  What perltidy does not parse and format

Perltidy indents but does not reformat comments and C<qw> quotes. 
Perltidy does not in any way modify the contents of here documents or
quoted text, even if they contain source code.  (You could, however,
reformat them separately).  Perltidy does not format 'format' sections
in any way.  And, of course, it does not modify pod documents.

=back

=head1 FILES

=over 4

=item Temporary files

Under the -html option with the default --pod2html flag, a temporary file is
required to pass text to Pod::Html.  Unix systems will try to use the POSIX
tmpnam() function.  Otherwise the file F<perltidy.TMP> will be temporarily
created in the current working directory.

=item Special files when standard input is used

When standard input is used, the log file, if saved, is F<perltidy.LOG>,
and any errors are written to F<perltidy.ERR> unless the B<-se> flag is
set.  These are saved in the current working directory.  

=item Files overwritten

The following file extensions are used by perltidy, and files with these
extensions may be overwritten or deleted: F<.ERR>, F<.LOG>, F<.TEE>,
and/or F<.tdy>, F<.html>, and F<.bak>, depending on the run type and
settings.

=item  Files extensions limitations

Perltidy does not operate on files for which the run could produce a file with
a duplicated file extension.  These extensions include F<.LOG>, F<.ERR>,
F<.TEE>, and perhaps F<.tdy> and F<.bak>, depending on the run type.  The
purpose of this rule is to prevent generating confusing filenames such as
F<somefile.tdy.tdy.tdy>.

=back

=head1 ERROR HANDLING

An exit value of 0, 1, or 2 is returned by perltidy to indicate the status of the result.

A exit value of 0 indicates that perltidy ran to completion with no error messages.

A non-zero exit value indicates some kind of problem was detected. 

An exit value of 1 indicates that perltidy terminated prematurely, usually due
to some kind of errors in the input parameters.  This can happen for example if
a parameter is misspelled or given an invalid value.  Error messages in the
standard error output will indicate the cause of any problem.  If perltidy
terminates prematurely then no output files will be produced.

An exit value of 2 indicates that perltidy was able to run to completion but
there there are (1) warning messages in the standard error output related to
parameter errors or problems and/or (2) warning messages in the perltidy error
file(s) relating to possible syntax errors in one or more of the source
script(s) being tidied.  When multiple files are being processed, an error
detected in any single file will produce this type of exit condition.

=head1 SEE ALSO

perlstyle(1), Perl::Tidy(3)

=head1 INSTALLATION

The perltidy binary uses the Perl::Tidy module and is installed when that module is installed.  The module name is case-sensitive.  For example, the basic command for installing with cpanm is 'cpanm Perl::Tidy'.

=head1 VERSION

This man page documents perltidy version 20200110

=head1 BUG REPORTS

A list of current bugs and issues can be found at the CPAN site L<https://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Tidy>

To report a new bug or problem, use the link on this page.  

The source code repository is at L<https://github.com/perltidy/perltidy>.

=head1 COPYRIGHT

Copyright (c) 2000-2020 by Steve Hancock

=head1 LICENSE

This package is free software; you can redistribute it and/or modify it
under the terms of the "GNU General Public License".

Please refer to the file "COPYING" for details.

=head1 DISCLAIMER

This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the "GNU General Public License" for more details.