in reply to Perl aesthetics: the good, the bad, the ugly.

The tradeoff: if you're running under strict and mistype a variable name, the compiler tells you. If you're running under strict, warnings, and taint mode and mistype a hash key, the compiler doesn't.

That's why I try not to pass too many arguments -- it's a sign that the function is too complicated.

  • Comment on Re: Perl aesthetics: the good, the bad, the ugly.

Replies are listed 'Best First'.
Re: Re: Perl aesthetics: the good, the bad, the ugly.
by Matts (Deacon) on May 01, 2002 at 15:06 UTC
    This is why you always have a param checking sub that you turn off unless $ENV{DEBUG} or something is true. There's plenty of examples of this type if thing on CPAN.
      Do these check that all uses of the param hash use the right keys? What you describe sounds to me like a sub that's called when populating the hash from @_ -- that's a good idea, but it's still not strict enough. I've come across code that uses 'style' in one place and 'stytle' in others.

      Clamped, read-only, psuedo-, or tied-hashes can fix this, but they're probably rare in production code.

      I wouldn't mind this convenience occasionally...