Version française

mod_erl

Erlang module for Apache

This module lets you use Erlang commands directly from your HTML page, without using a CGI script or a dedicated HTTP server. You can download a preliminary version (0.5) under a BSD licence.

Latest changes

New in version 0.5
------------------

* A new package http_security allows a WWW page to authenticate the user
  by any mean.

New in version 0.4
------------------

* The POST method is working.
* A bug relative to long outputs from Erlang has been fixed. Please upgrade
  as soon as possible.
* Proper error logging is done.

New in version 0.3
------------------

* It is now possible to set headers and return code from Erlang, and to
  force the Apache process to return only headers, and to do it
  immediately (the idea is to allow this to be usable with HTTP
  authentication).
* The code in eerl_handler is now bundled in the html_gen Erlang
  application. However, this application does not have the right
  structure yet, this will be done in 0.4. Also, this code is
  basically documented in the README file.

New in version 0.2
------------------

* The socket will be reused
* More helper functions are available on the Erlang side
* It should now be possible to set the return code (402, 500, etc.) from
  Erlang, as well as the Content-Type

Let's take as an example
Seen on screen Actual code
<? io_lib:format ("date = ~p, time = ~p", [erlang:date(), erlang:time()]) ?>
1 + 2 = 1+2 , 6 * 7 =
1 + 2 = <erl> 1+2 </erl>,
6 * 7 = <? 6*7 ?>
fact (20) = 1; (N, G) -> N * G (N-1, G) end, F (20, F) ?>
fact (20) =
<?
  F = fun (0, _) ->
            1;
          (N, G) ->
            N * G (N-1, G)
      end,
  F (20, F)
?>
    lists:foldl (fun (X, Y) -> Y ++ "
  • " ++ X ++ "\n" end, "", get (env))
<ul>
<erl>
lists:foldl
  (fun (X, Y) ->
     Y ++ "<li>" ++ X ++ "\n"
   end,
   "",
   get (env))
</erl>
</ul>
<? get (input) ?>
  
D = eerl_handler:parse_query (), io_lib:format ("~p", [dict:dict_to_list (D)])
<erl>
 D = eerl_handler:parse_query (),
 io_lib:format ("~p", [dict:dict_to_list (D)])
</erl>