Hm.... What I always do, is I start yaws in intractive mode (yaws -i or
sudo yaws -i) and then do all the erlyweb stuff from there. Then I see
all the io:format messages just fine
How do you attempt to do the redirect? Since before_call should return a
tuple in the form of {NewFunc, Params}, a redirect to a different
function may probably look like this (this is untested, so there could
be mistakes):
-compile(export_all).
before_call(call_1, A) ->
{new_func, A}; %% substitute function, no visible redirect
before_call(call_2, A) ->
{call_2, A}; %% call the actual function,
%%let the function do a redirect
before_call(call_3, A) ->
{new_func_3, A}. %% call a substtute function,
%% let it do a redirect,
%% same as above, with a new name
new_func(A) ->
do_some_stuff,
{data, ok}.
call_2(A) ->
{ewr, some_controller}.
new_func_3(A) ->
{ewr, some_other_controller}.
As for a wiki, that'd be grand :) The only problem is that it should
really be an Erlang-based wiki to show off the ErlyWeb... Or, probaby,
some interim wiki...
> Thanks man.
>
> Do you know if there is anything more I have to do: I have a trace
> statement put in the execution of before_call/2 but I don't see it
> being printed in the console and it does not appear to redirect to the
> URL I point it to. I don't think it works at all.
>
> I think we should all work towards a wiki for erlyweb so that people
> who have done stuff like this sort of stuff before would be able to
> document it. But as it stands, even for the simplest things, it seems
> you have to go through a lot of effort due to inadequate
> documentation.
>
> On Oct 27, 12:04�pm, Dmitrii Dimandt <[EMAIL PROTECTED]> wrote:
>
>> On Oct 26, 2008, at 12:57 PM, nii amon wrote:
>>
>>
>>
>>
>>> 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:
>>>
>> I believe this should be something like this:
>>
>> -export([before_call/2]).
>>
>> before_call(is_logged_in, A) ->
>> � � �io:format("hello"),
>> � � �{is_logged_in, A};
>> before_call(Func, A) ->
>> � � �{Func, A}.
>>
>> because we need to return {NewFuncName::atom(), NewParams::[term()]} �
>> from this function
>>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---