[erlang-questions] a little meta-programing help
Mon Oct 6 20:26:28 CEST 2008
On Sun, Oct 5, 2008 at 7:31 PM, anders conbere <aconbere@REDACTED> wrote:
> On Sun, Oct 5, 2008 at 4:12 PM, Antoine Koener <antoine.koener@REDACTED> wrote:
>> On Mon, Oct 6, 2008 at 12:15 AM, anders conbere <aconbere@REDACTED> wrote:
>>> Today I sat down to try to make working with mochiweb a little cleaner
>>> for myself. I wanted a way to specify a list of mappings between url
>>> patterns and methods to be called with the matched variables from
>>> them. I quickly ran into issues with not being able to create patterns
>>> dynamically, and then tried using funs to wrap that functionality but
>>> pretty soon I was back at the same mess I started with.
>> I used the list_to_atom fun to build the module name.
>> This is not recommended but it's still really useful:
>> check out: http://easyerl.blogspot.com/2008/07/my-mochiweb-webservice.html
> Yeah, so I'm working more under the presumption that I can specify the
> route to the module for each mapped url pattern. I'm not supper
> interested in mapping urls to modules from the actual url text.
Hi, Anders. I might suggest that you take a look at the webmachine
project. It has a module that does dispatch and binding on URLs, and
is built on top of mochiweb. I'm not sure if it's exactly what you're
looking for, but it's in the same vein.
Take a look at webmachine_dispatcher.erl from
Details about its dispatch configuration syntax are here:
More information about the erlang-questions