SPUG: Advice on sub return-code policies?

Michael R. Wolf MichaelRWolf at att.net
Wed Oct 4 22:29:42 PDT 2006

> The client I'm working with this week wants to develop a large
> enterprise application in Perl using a special policy: every sub needs
> to return a standardized "error code".


> What advice would you offer to a client like this?

1.  The nice thing about "standards" is that there are so many to choose

2. Or to take liberties with an Alan Perlis epigram....

  When someone says 
    "I want a programming language in which I need only say 
     what I wish done", give him a lollipop.

Perhaps you can candy coat the request like this...

  When a user says "I want a system in which every function call is
consistent", give him a lollipop.

See more Alan Perlis epigrams at:
  Perlisisms - "Epigrams in Programming" by Alan J. Perlis
  Epigrams on Programming

3. Take a look at the root problem of trying to get consistent with the
flexibility and expressiveness (say "inconsistency") of Perl.  I've seen a
few discussions of the root problem.  See Contextual::Return (or the section
in Perl Best Practices) for an extended discussion.

Contextual::Return - Create context-senstive return values - search.cpan.org

4.  Divide the problem into small enough contexts that "standardized return
values" makes sense.  I've often heard it said that there is nothing more
unfair than treating un-equals as equals.

Michael R. Wolf
    All mammals learn by playing!
        MichaelRWolf at att.net

More information about the spug-list mailing list