[erlang-questions] Question about parametrized modules

Robert Raschke rtrlists@REDACTED
Mon Aug 9 13:08:41 CEST 2010


On Sun, Aug 8, 2010 at 2:47 PM, Filipe David Manana <fdmanana@REDACTED>wrote:

> I have a function_clause error when calling some functions of a
> parametrized
> module which use one of the module parameters.
> The module in question (from mochiweb) is like:
>
> -module(mochiweb_request, [Socket, Method, RawPath, Version, Headers]).
> -export([get/1]).
>
> % ...
>
> get(socket) ->
>   Socket;
> get(scheme) ->
>   case mochiweb_socket:type(Socket) of
>       plain ->
>           http;
>       ssl ->
>           https
>   end;
> get(method) ->
>   Method;
> get(raw_path) ->
>   RawPath;
> get(version) ->
>   Version;
> get(headers) ->
>   Headers;
>
> Then, from another module, which has an instance of that parametrized
> module
> (mochiweb_request) I have:
>
> 1) a call like MochiReq:get(socket)  - this one succeeds
>
> 2) a call like MochiReq:get(scheme) - it fails with the stack trace bellow:
>
>           {error,function_clause,
>               [{mochiweb_request,get,
>                    [scheme,
>                     {mochiweb_request,#Port<0.2224>,'GET',"/_utils",
>
>
Stupid question, sorry, but you did recompile and are running your new
version, yes?

Because that error looks like the mochiweb_request:get function simply
doesn't understand you arguments. And my first guess would be that it
doesn't understand 'scheme'.

Robby


More information about the erlang-questions mailing list