Re: foreach routine
- Posted by duke normandin <dnormandin at bsdrocksperlrolls.com> Dec 22, 2006
- 680 views
Chris Bensler wrote: > > duke normandin wrote: > > > > What I was going to say is: > > > > CONTENT_LENGTH will either be empty or contain the number of chars/bytes > > sent. So > > if atom(tmp) then > > > > checks to see if getenv() returned a number, right? If true, we have that > > many chars/bytes. If 0 CONTENT_LENGTH was empty. > > > > Do I need another cup of coffee? or something? It seems that the logic > > is backwards. TIA... (now hit the send button, duke) > > -- > > duke > > The getenv() routine will return -1 if the environment variable CONTENT_LENGTH > doesn't exist. If it does exist, a string will be returned. Are you sure? I've never proven this to myself, but it has always been my understanding that with respect the method=POST, the ENV. VAR. CONTENT_LENGTH would be set to the amount of bytes sent out. THEREFORE, this is why we "read" that many bytes from STDIN, and only that many. So my point is that CONTENT_LENGTH will in one case be a positive number or a -1 -- both atoms. No? The above of course does not apply to method=GET, because in the latter, all the data is stuffed in the ENV. VAR. QUERY_STRING. Here we can check to see if getenv("QUERY_STRING") returns an atom i.e -1, because QUERY_STRING will either contain a string, or will be undefined. -- duke