[erlang-questions] yaws crashes

Johnny Billquist bqt@REDACTED
Tue Feb 10 15:44:08 CET 2009


Salonee Sinha Roy wrote:
> Hi
> I am trying to write a simple facebook app with iframes using yaws. My 
> code is below
> 
> <erl>   
> out(Arg) ->
>     {ok,User} = queryvar(Arg,"fb_sig_user"),
>     case queryvar(Arg,"fb_sig_user_add") of
>         {ok,Page} ->
>         %% check if the user has added the app
>             if
>                     Page == "0" ->
>                     
> {redirect_local,string:concat("/www/terms_cond.html?soc=fb&uid=",User)};
>                 Page == "1" ->
>                     
> {redirect_local,string:concat("/www/mask_flash.html?soc=fb&uid=",User)}
>             end
>     end.
> </erl>       
> 
> 
> When I try going to the page above I get the following error

[...]

Simple. queryvar(Arg,"fb_sig_user_add") is not returning one of the 
values you have listed in the case. :-)

And if I may give a suggestion, I would write it like this:

<erl>
out(Arg) ->
   {ok,User} = queryvar(Arg,"fb_sig_user"),
     case queryvar(Arg,"fb_sig_user_add") of
       {ok,"0"} ->
{redirect_local,string:concat("/www/terms_cond.html?soc=fb&uid=",User)};
       {ok,"1"} ->
{redirect_local,string:concat("/www/mask_flash.html?soc=fb&uid=",User)};
       _ ->
%% Don't know what I might do here

     end.
</erl>


It makes it nicer to view and understand I think. And I hope you see 
where you end up in the code above for your test. :-)

	Johnny

-- 
Johnny Billquist                  || "I'm on a bus
                                   ||  on a psychedelic trip
email: bqt@REDACTED             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol



More information about the erlang-questions mailing list