IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 24, 2004, 3:51:32 PM (22 years ago)
Author:
jhoblitt
Message:

add sections on inheritance and subroutine calling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/misc/perlCodeConventions.tex

    r2424 r2464  
    1 %%% $Id: perlCodeConventions.tex,v 1.33 2004-11-24 12:08:25 jhoblitt Exp $
     1%%% $Id: perlCodeConventions.tex,v 1.34 2004-11-25 01:51:32 jhoblitt Exp $
    22\documentclass[panstarrs]{panstarrs}
    33
     
    11471147\end{verbatim}
    11481148
     1149\subsubsection{Inheritance}
     1150
     1151Don't use the \code{@ISA} package variable for subclassing.  Instead, use the
     1152\code{base} pragma.
     1153
     1154\begin{verbatim}
     1155    use base qw( Foo );                 # Correct
     1156    our @ISA = qw( Foo );               # AVOID!
     1157\end{verbatim}
     1158
     1159\subsubsection{Calling Subroutines}
     1160
     1161Do not use the \code{&} sigil to to disambiguate a subroutine from a
     1162``bare-word''.  Instead, use empty parentheses adjoined to the subroutine call.
     1163
     1164\code{subs} pragma is a last resort.
     1165
     1166\begin{verbatim}
     1167    fooBar($foo);                       # Correct
     1168    fooBar();                           # Correct
     1169    &fooBar;                            # AVOID!
     1170    &fooBar();                          # AVOID!
     1171    use subs qw( fooBar );              # last resort - Correct
     1172\end{verbatim}
     1173
    11491174%------------------------------------------------------------------------------
    11501175\appendix                               %Begin Appendices
Note: See TracChangeset for help on using the changeset viewer.