subroutine placement (Layout conventions)

From: B McKee (binlinux_at_hotmail.com)
Date: 02/26/04


Date: Thu, 26 Feb 2004 12:47:28 -0500
To: beginners@perl.org

Hi All,

        I'm slowly creating my Perl Masterpiece (tm)
I'll let ya all giggle over it when I'm done :-)
At any rate - It's done what I believe you call "top-down".
I declare the subs, then have the code for the main program,
then the subroutine code blocks.
My question is what order should the subroutines appear in?
Alphabetical? Order of appearance? Rough grouping by function?
The fact that some subroutines may or may not call other subroutines
and some of the subs are called by pretty much all the other subs
makes it hard for me to decide what order would make it easiest to read.
What's the 'standard'?

Brian



Relevant Pages

  • Re: subroutine placement (Layout conventions)
    ... >> I declare the subs, then have the code for the main program, ... >> The fact that some subroutines may or may not call other subroutines ... >> and some of the subs are called by pretty much all the other subs ... > I have a habit of writing them in alphabetical order. ...
    (perl.beginners)
  • Re: subroutine placement (Layout conventions)
    ... a less-than-acceptable Perl script. ... to provide a higher-level action. ... > The fact that some subroutines may or may not call other subroutines ... > and some of the subs are called by pretty much all the other subs ...
    (perl.beginners)
  • balanced paren regexs
    ... presume I can recognize subs because subs and only subs always start at ... by a name and can contain nested expressions. ... this must be a fairly common problem (e.g., extracting tex macro ... paren counter subroutines on individual characters, ...
    (comp.lang.perl.misc)
  • Re: First attempt at a module fails
    ... Gary Schenk wrote: ... The returnfunctions in your subroutines are irrelevant. ... values from your subs, ... Did you at least *try* following James' advice before you decided he ...
    (comp.lang.perl.misc)
  • Re: subroutine placement (Layout conventions)
    ... > The fact that some subroutines may or may not call other subroutines ... > and some of the subs are called by pretty much all the other subs ... I believe this is all pretty matter of opinion stuff. ... I have a habit of writing them in alphabetical order. ...
    (perl.beginners)