It appears that I needed to include the before_call/2 in the list of
exported functions. That takes care of the previous problem.

However I have come up with a new problem. So now I have this:

before_call(is_logged_in, A) ->
        io:format("hello. I see you").

just to test to see if the call would be made right. I end up with
this error:

ERROR erlang  code  crashed:
 File: appmod:0
Reason: {function_clause,
            [{dashboard_controller,before_call,
                 [index,
                  [{arg,#Port<0.7415>,
                       {{127,0,0,1},49695},
                       {headers,"keep-alive",
                           "text/xml,application/xml,application/xhtml
+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
                           "localhost:
8057",undefined,undefined,undefined,
                           undefined,undefined,undefined,undefined,
                           "Mozilla/5.0 (Macintosh; U; PPC Mac OS X;
en) AppleWebKit/523.12.2 (KHTML, like Gecko) Version/3.0.4 Safari/
523.12.2",
                           undefined,
                           ...

>From what I see, this means that no function clause matched the
incoming function signature. Has anyone used before_call/2
successfully?

Thanks
Nii AMon

On Oct 26, 4:52 am, nii amon <[EMAIL PROTECTED]> wrote:
> Hi guys
>
> Does anyone have an example of how to use before_call to check if a
> user is logged in assuming that we use sessions to track logged in
> users? I am in a bit of trouble trying to get this to work. I have
> something like below:
>
> before_call(is_logged_in, A) ->
>         {is_logged_in, [A]}.
>
> is_logged_in([A]) ->
>         case utilman:check_cookie(A) of
>                 {ok, Sess} ->
>                         % do something
>                 _ ->
>                         % do something
>         end.
>
> I get a long error trace when I try to access a function in the
> controller:
>
> Reason: {undef,
>             [{dashboard_controller,before_call,
>                  [index,
>                   [{arg,#Port<0.5879>,
>                        {{127,0,0,1},60507},
>                        {headers,"keep-alive",
> ....
>
> Does anyone know how to make this work?
>
> Thanks
> Nii AMon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to