Changeset 2362 for trunk/doc/misc/perlCodeConventions.tex
- Timestamp:
- Nov 12, 2004, 5:33:53 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/doc/misc/perlCodeConventions.tex (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/misc/perlCodeConventions.tex
r2361 r2362 1 %%% $Id: perlCodeConventions.tex,v 1.1 3 2004-11-13 03:12:31jhoblitt Exp $1 %%% $Id: perlCodeConventions.tex,v 1.14 2004-11-13 03:33:53 jhoblitt Exp $ 2 2 \documentclass[panstarrs]{panstarrs} 3 3 … … 295 295 alone file is as follows: 296 296 297 e.g. for file Foo.pod: 298 297 299 \begin{verbatim} 298 300 =pod … … 469 471 \begin{verbatim} 470 472 if ($foo) { 471 # print( "foo");473 # print("foo"); 472 474 } 473 475 \end{verbatim} … … 482 484 if (0) { 483 485 if ($foo) { 484 print( "foo");486 print("foo"); 485 487 } 486 488 } … … 738 740 \subsection{if, if-else, if elsif else Statements} 739 741 740 \code{if} statements must always use braces {} around statements and parenthesis742 \code{if} statements must always use braces \{\} around statements and parenthesis 741 743 () around conditionals. 742 744 … … 796 798 797 799 A Perlish \code{for} or \code{foreach} statement (also known as an iterator) 798 should have the foll iwng form:800 should have the following form: 799 801 800 802 \begin{verbatim} … … 847 849 MYLABEL: while (condition) { 848 850 if (condition) { 849 next ;851 next MYLABEL; 850 852 } 851 853 } … … 980 982 Constants & 981 983 982 Perl's \code{constant} pragma should be used to declare constants. Note: 983 'constants' created this way can not be interpolated inside of double quoted 984 strings.984 Constant names should be in all capital letters and highly descriptive. The 985 \code{constant} pragma should be used to declare constants. Note: 'constants' 986 created this way can not be interpolated inside of double quoted strings. 985 987 986 988 & 987 \code{use constant MAXLEN => 40;}\hfil\break988 \code{use constant LENGTH => qw(2, 4, 8);}\hfil\break989 \code{use constant PI => 3.14159265;}\hfil\break 990 \code{use constant LENGTHS => qw(2, 4, 8);}\hfil\break 989 991 \code{use constant CLASSES => (raw => 1, processed => 2);}\hfil\break 990 992 … … 1001 1003 \code{package Time::HiRes;}\hfil\break 1002 1004 \code{package XML::SimpleObject;}\hfil\break 1005 1006 \\ 1007 1008 Labels & 1009 1010 Label names should be in all capital letters and short. Generally they should 1011 attempt to describe the 'thing' being operated on by the loop they are labeling. 1012 1013 & 1014 1015 \code{LINE:}\hfil\break 1016 \code{CONNECTION:}\hfil\break 1017 \code{IMAGE:}\hfil\break 1003 1018 1004 1019 \\
Note:
See TracChangeset
for help on using the changeset viewer.
