How To Dynamic Web Rendering?

Adam D. Ruppe destructionator at gmail.com
Mon May 23 09:47:04 PDT 2011


Nathan wrote:
> I cannot get the second, cgi/mixin sample to compile. What is the
> appropriate dmd command line?

First, download my cgi module

http://arsdnet.net/dcode/cgi.d

Then, in the same directory write this file, hello.d:

===
import arsd.cgi;

void whatever(Cgi cgi) {
   cgi.write("Hello!");
}

mixin GenericMain!(whatever);
====


And use this command line:

dmd hello.d cgi.d


Make sure you are using a recent dmd2 compiler like 2.053 from here:
http://digitalmars.com/d/2.0/changelog.html


You should get a program hello that, when run on the command
line, outputs this:

=====
Cache-Control: private, no-cache="set-cookie"
Expires: 0
Pragma: no-cache
Content-Type: text/html; charset=utf-8

Hello!
=====


Copy it to a cgi enabled directory ( cgi-bin/ is preconfigured
on most Apache installs) and you should be able to access it
from the web:

http://arsdnet.net/cgi-bin/test



If it doesn't work, can you copy/paste the errors in here?


More information about the Digitalmars-d-learn mailing list