Erlang/OTP Forums

Author Message

<  Advanced Erlang/OTP  ~  syntax error in rewrite module

hiveminds
Posted: Sat Apr 25, 2009 9:04 pm Reply with quote
User Joined: 15 Apr 2009 Posts: 12 Location: Sweden
I get this:

6> c(rewriter.erl).
./rewriter.erl:25: syntax error before: '->'
./rewriter.erl:3: function arg_rewrite/1 undefined
error
7>

When trying to compile the code from http://wiki.github.com/klacke/yaws/rewrite-module

Code:
-module(rewriter).

-export([arg_rewrite/1]).

-include_lib("yaws/include/yaws_api.hrl").

arg_rewrite(ARG) ->
        Req = ARG#arg.req,
        case Req#http_request.path of
        {abs_path, RawPath} ->
        case (catch yaws_api:url_decode_q_split(RawPath)) of
        {'EXIT', _} -> %%broken request - ignore let yaws_server handle it.
            ARG2 = ARG;
        {DecPath, QueryPart} ->
             Parts = string:tokens(DecPath,"/"),   
            case lists:member("viewvc",Parts) of
            true ->

                %%
                %Do something with DecPath & QueryPart
                %
                case QueryPart of
                [] ->
                    %% Rewritten = SomeNewpath;
                _Other ->
                    %% Rewritten = SomeNewpath ++ "?" ++ QueryPart
                end,
                %
                %%   

                  Req2 = Req#http_request{path = {abs_path, Rewritten}},

                ARG2 = ARG#arg{req = Req2};           
            false ->         
                ARG2 = ARG
            end   
        end;
        _Else ->
        ARG2 = ARG
        end,   

        ARG2.


I am on windows xp with the latest erlang release installed.

Can anyone help? TIA

_________________
Hiveminds.co.uk
_______________

Concurrent and Collective
View user's profile Send private message Visit poster's website
uwiger
Posted: Sun Apr 26, 2009 2:40 pm Reply with quote
User Joined: 03 Jul 2006 Posts: 604 Location: Sweden
hiveminds wrote:
I get this:

6> c(rewriter.erl).
./rewriter.erl:25: syntax error before: '->'
./rewriter.erl:3: function arg_rewrite/1 undefined
error
7>

When trying to compile the code from http://wiki.github.com/klacke/yaws/rewrite-module


That module is just a template. The case clause bodies only have comments in them. You have to supply actual code for each case.

BR,
Ulf W
View user's profile Send private message Visit poster's website

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum