[erlang-questions] ANNOUNCE: adapter_pattern for mochiweb/cowboy/misult and scripting language

Joe Armstrong erlang@REDACTED
Fri Feb 17 15:31:57 CET 2012

This is an experiment - but the code is rather pretty so it might be
of interest.


What's this all about? Mochweb, misultin and cowboy all have
*different* interfaces
I don't like this. I have made a simple generic interface to all three.

Yesterdays announcement that misultin would not be supported in the future
sparked off this work - I'd been thinking about how to abuse
paramerised modules for a while
so this seemed like a golden opportunity.

I also threw in a web scripting language called EHE. EHE is "Html with
embedded Erlang"

So  <?e Name = "joe" ?> has <?e integer_to_list(Name) ?> characters

would print out "joe has 3 characters" - inside the <?e ... ?> we
expect a sequence of
Erlang expressions. The replacement value is the value of the *last*
expression in the
sequence which must be a string. Bindings are forward propagated in the script.

That's it.

Although this is *very* simple it is also very powerful (ie it has the
full power of all of erlang)

It is also very easy to embed into your favorite web server - the
example on github shows how
to embed ehe into mochiweb/misultin and cowboy.

It would seem to me to be advantageous to agree to use EHE (or
something better) on all
available erlang web-servers - since a common langage would encourage
code sharing and so on
(like PHP)

Take a look?

Is this the right way to go?



More information about the erlang-questions mailing list