[erlang-questions] Alternative Default Webmachine Functions

Loïc Hoguin essen@REDACTED
Mon Sep 5 20:27:17 CEST 2011


On 09/05/2011 07:52 PM, Tristan Sloughter wrote:
> This should be a generic Erlang question even though its being used for
> writing Webmachine resources.
> 
> Basically my problem stems from extends not adding the base modules
> exports to the exports of the module extending it, as far as I can tell
> at least form module_info(functions). So something like:
> 
> -model(resource_user).
> -extends(resource_base).
> 
> Where resource_base exports some Webmachine functions like:
> 
> -exports([init/1]).
> 
> init([]) ->
>     {ok, #ctx{}}.
> 
> Does not work becase Webmachine does not see a resource_user:init/1.
> 
> Does anyone have a suggestion on an alternative way to achieve this? I
> want to be able to override the function in resource_user so it does not
> use the resource_base or default Webmachine function.

Not answering your question directly, but can't you solve that using a
parse_transform instead? Add the missing functions at compile time with it.

-- 
Loïc Hoguin
Dev:Extend



More information about the erlang-questions mailing list