[erlang-questions] how to patch a standard module

Tomasz Maciejewski ponton@REDACTED
Thu Jan 13 22:25:54 CET 2011

Dnia 13-01-2011 o 16:52:23 Gijsbert <gijsbert.de.haan@REDACTED> 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.

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

More information about the erlang-questions mailing list