Today I broke down the CGI module into parts just to show people why they shouldn't reinvent their own version. Enough with all the talking, here is what I found.

  1. The CGI module is roughly 7000 lines to start with. So, to start off *snip* there goes around 3000 lines of pod. 4000 or so left.
  2. Around 1000 of that finds out about the OS and how to get the parameters. So *snip* 2000 left.
  3. Then we have the HTML generating functions, filehandle manipulators, and redirecting utilities which comes out around 1000 lines there, too. *snip* 1000 left.
  4. This 1000 lines deals with grabbing the parameters, the lists of parameters, encoding and decoding the parameters, uploading, and much other stuff.
  5. This last 1000 lines goes through 34 subroutines of parsing and other stuff.
So if you want to include 1000 lines in your program to get the parameter grabbing right, then go right ahead. For all of you others, good job for using the module.

What is probably most humorous about this is that most of the param parsing routines I see are around 1-30 lines long! When the right way is 1000 lines! I just don't get it.

Go check out chromatic's home node for more reasons why NOT to try to reinvent this wonderful, *round* wheel :)

Almost a Perl hacker.
Dave AKA damian

I encourage you to email me

Replies are listed 'Best First'.
Re: Just some CGI statistics
by Desdinova (Friar) on Mar 27, 2001 at 12:14 UTC
    That really puts the idea in perspective. The longer i read perlmonks the less i can understand why anyone who want to re-invent this wheel. I mean it's like a 'C' programmer writing his own stdio.h files on a whim (I once had a coworker do that!).
Re: Just some CGI statistics
by busunsl (Vicar) on Mar 27, 2001 at 12:11 UTC
    Er, just a question:

    1. leaves 4000 lines
    2. strips 1000 lines
    and leaves 2000? Shouldn't that be 3000?
    That would make your argument even stronger!

      Well it would have been 3000 but the program is only around 6500 or so. So, its off but you get the idea :)

      Almost a Perl hacker.
      Dave AKA damian

      I encourage you to email me