Re: foreach routine

new topic     » goto parent     » topic index » view thread      » older message » newer message

Chris Bensler wrote:

> 
> Here is some Eu code to do what you want (split() function sold separately)
> Warning: code is not tested, consider it a guideline only
> 
> }}}
<eucode>
> include get.e -- needed for get_bytes() and value()
> sequence pairs,pair
> sequence name,data -- ('value' is a standard routine name, so I will use
> 'data' instead)
> sequence buffer
> object tmp -- temporary/intermediate variable
> 
> tmp = getenv("CONTENT_LENGTH")
> if atom(tmp) then
>   -- CONTENT_LENGTH was not found
> else
>   tmp = value(tmp)
>   if tmp[1] != GET_SUCCESS then
>     -- value() failed
>   else
>     buffer = get_bytes(STDIN,tmp[2])
>     pairs = split(buffer,'&')
>     for i = 1 to length(pairs) do
>       pair = pairs[i]
>       tmp = split(pair,'=')
>       name = tmp[1]
>       data = tmp[2]
>       -- blah
>       -- blah
>     end for
>   end if
> end if
> </eucode>
{{{


Thanks Chris.... 

Why am I not getting this?

tmp = getenv("CONTENT_LENGTH")
if atom(tmp) then

CONTENT_LENGTH 
--
duke

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu