IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 23, 2004, 1:37:29 PM (22 years ago)
Author:
jhoblitt
Message:

add loading modules

File:
1 edited

Legend:

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

    r2409 r2410  
    1 %%% $Id: perlCodeConventions.tex,v 1.31 2004-11-23 23:20:38 jhoblitt Exp $
     1%%% $Id: perlCodeConventions.tex,v 1.32 2004-11-23 23:37:29 jhoblitt Exp $
    22\documentclass[panstarrs]{panstarrs}
    33
     
    11171117\end{verbatim}
    11181118
     1119\subsubsection{Loading Modules}
     1120
     1121Modules may be loaded with an optional version requirement.  This is
     1122particularly useful for modules that exist in the Perl core but have newer
     1123versions available on CPAN.
     1124
     1125\begin{verbatim}
     1126    use Foo;                            # Correct
     1127    use Foo 0.02;                       # Correct
     1128\end{verbatim}
     1129
     1130Don't use \code{require} to prevent a module from exporting symbols into the
     1131caller's namespace.  Instead, provide \code{use} with an empty parameter list.
     1132
     1133\begin{verbatim}
     1134    use Foo qw();                       # Correct
     1135    use Foo ();                         # Correct
     1136    require Foo;                        # AVOID!
     1137\end{verbatim}
     1138
     1139This also works with a minimum module version requirement.
     1140
     1141\begin{verbatim}
     1142    use Foo 0.02 qw();                  # Correct
     1143\end{verbatim}
    11191144
    11201145%------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.