Hi,

 

I am not sure if this is the right place to post this question about yaws and erlydtl, but I am doing it anyway.

 

I took this example from the upcoming book ‘Building Web Applications with Erlang’ .

 

I setup yaws and erltdtl as follows

 

(foo@plun0142)1> code:add_path("/home/u1c332/test/templates/erlydtl/ebin").

true

 (foo@plun0142)3> code:add_path("/home/u1c332/erlydtl-0.7.0/ebin").

true

(foo@plun0142)4> l(erlydtl).

{module,erlydtl}

(foo@plun0142)5> cd("templates").

/home/u1c332

ok

(foo@plun0142)6> cd("/home/u1c332/test/templates").

/home/u1c332/test/templates

ok

 

(foo@plun0142)9> erlydtl:compile("/home/u1c332/test/templates/hello_world.dtl",hello_world,[{out_dir,"/home/u1c332/test/templates/erlydtl/ebin"}]).

Ok

 The dtl code is  at /home/u1c332/test/templates/ hello_world.dtl  is

 <h1>Hello {{ planet }} </h1>

 The compilation produces a beam at:

/home/u1c332/test/templates/erlydtl/ebin/ hello_world.beam

 

I constructed this yaws code in /home/u1c332/test/yaws/www/ hello_world.yaws

<erl>

out(Arg) ->

{ok,HTML} = hello_world:render([{planet, "Earth"}]),

{html, HTML}.

</erl>

 When called at http://plun0142:8001/hello_world.yaws

 It should  output this:

 <h1>Hello Earth </h1>

 But I am getting this instead

Internal error, yaws code crashed

 


 

ERROR erlang  code  crashed:

 File: /home/u1c332/test/yaws/www/hello_world.yaws:1

Reason: {undef,[{hello_world,render,[[{planet,"Earth"}]],[]},

                {m9,out,1,

                    [{file,"/home/u1c332/.yaws/yaws/default/m9.erl"},

                     {line,12}]},

                {yaws_server,deliver_dyn_part,8,

                             [{file,"yaws_server.erl"},{line,2652}]},

                {yaws_server,aloop,3,[{file,"yaws_server.erl"},{line,1167}]},

                {yaws_server,acceptor0,2,

                             [{file,"yaws_server.erl"},{line,1025}]},

                {proc_lib,init_p_do_apply,3,

                          [{file,"proc_lib.erl"},{line,227}]}]}

Req: {http_request,'GET',{abs_path,"/hello_world.yaws"},{1,1}}

Stack: [{hello_world,render,[[{planet,"Earth"}]],[]},

        {m9,out,1,[{file,"/home/u1c332/.yaws/yaws/default/m9.erl"},{line,12}]},

        {yaws_server,deliver_dyn_part,8,

                     [{file,"yaws_server.erl"},{line,2652}]},

        {yaws_server,aloop,3,[{file,"yaws_server.erl"},{line,1167}]},

        {yaws_server,acceptor0,2,[{file,"yaws_server.erl"},{line,1025}]},

        {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]

 

Any help is welcomed.

 

 Thanks,

Mohamed

 

====================
This email/fax message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution of this
email/fax is prohibited. If you are not the intended recipient, please
destroy all paper and electronic copies of the original message.