[erlang-questions] Alternative Default Webmachine Functions

Tristan Sloughter <>
Mon Sep 5 20:33:43 CEST 2011


Hehe, yeah, that is my backup solution. When I go to reach for a parse
transform or writing my own behaviour I always try to just assume I'm
missing something simple. And not until I'm sure of no other option I go
with those.

Tristan

On Mon, Sep 5, 2011 at 1:27 PM, Loïc Hoguin <> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110905/2fcfbe81/attachment.html>


More information about the erlang-questions mailing list