how to patch a standard module

Gijsbert <>
Fri Jan 14 00:47:03 CET 2011



On Jan 13, 10:25 pm, "Tomasz Maciejewski" <> wrote:
> Dnia 13-01-2011 o 16:52:23 Gijsbert <> napisał(a):
>
> > Hi,
>
> > I'd like to extend httpd_request.erl to handle the OPTIONS method.
> > I've managed to do this by copying httpd_request.erl into my project
> > and making sure it overrides the standard version.
> > My question: is it possible to redefine a function in a standard
> > module at runtime? Then I could define my own validate(Method, Uri,
> > Version) function (just a few lines) and keep using the standard
> > httdp_request.erl.
>
> > Regards,
> > Gijsbert
>
> If you like to extend httpd, you should write a module for it, instead of patching original http_request.erl. All the informations are here:http://www.erlang.org/doc/man/httpd.html. You can also see how mod_get.erl and mod_head.erl are done.

Alas, my module is never called because httpd_request:validate() does
not have a clause for "OPTIONS" and returns {error,
{not_implemented, ...}}. As far as I know I cannot extend the
validation phase of httpd.

>
> For redefining function at runtime, you can compile and load modified module by typing "c(module)", or just load new beam by "l(module)".
>
> --
> Tomasz Maciejewski
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> Seehttp://www.erlang.org/faq.html
> To unsubscribe; mailto:


More information about the erlang-questions mailing list