CamlGI code has been integrated into the Netcgi component
<https://gps.dynxs.de/wwwsvn/trunk/code/src/netcgi/?root=lib-ocamlnet2>
of OcamlNet-2 <https://gps.dynxs.de/openapps/svnindex.cgi>, please use
that instead.
> [...] script that [...] prints a webpage saying only "Yes", "No",
> "Other" or "Undefined" depending on whether the CGI variable "foo"
> has value 1, 0, some other defined value, or is undefined (never
> mind about multiple values)?
You can find examples in the examples/ directory (add.ml is a very
simple one). As for the specific example you desire, it is attached.
It is maybe a bit more complex that you expected because it
demonstrates additional features (text escaping, setting the header,
buffered output).
Hope it helps,
ChriS
Ok. I was pointing you to the subversion repository so you can browse
the files and see whether that is what you need. You can download the
files with
svn co https://gps.dynxs.de/svn/lib-ocamlnet2/trunk/ lib-ocamlnet2
> When I tried to configure OcamlNet2 it said it needed PCRE -- and even
> though I installed what was labelled as PCRE from
> ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ , OcamlNet-2 refused
> to configure because it couldn't recognize PCRE as being installed, and when
> I commented out the test for PCRE in the configure it still couldn't find
> it.
You need the OCaml interface to the C library. Get it here:
http://ocaml.info/home/ocaml_sources.html#toc13
Hope it helps,
ChriS
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
#!/usr/local/bin/ocamlrun ocaml
You also need to load the necessary libraries:
#load "pcre.cma";;
#load "unix.cma";;
...
#load "netcgi.cma";;
(see attached file).
> when I run it from within apache I get an internal server error. (A
> copy of the command line output follows the script).
Do you run is as CGI ? Also beware that the newer Netcgi module is
not in the tarball you mentioned. Get the SVN version if you want to
use it (I am not sure the build system already compiles it as its
insersion is very recent but I can fix that).
Cheers,
ChriS
you might want to try:
#!/usr/local/bin/ocamlrun ocaml
This is what I had to do with my webhost for some reason.
Hello,
> let main (cgi:cgi) =
> cgi#set_header
> ~cache:`No_cache
> ~content_type:"text/html; charset=\"iso-8859-1\""
> ();
> let foo = cgi#argument_value "foo"
Maybe "in" is missing here ? ^^
Hope this helps,
--
Maxence Guesdon
http://yquem.inria.fr/~guesdon/
http://devel.inria.fr/rocq/
Well, I do not know the reason but it is the second time "you"
suppresses the necessary "in". The line
> let foo = cgi#argument_value "foo"
should read
let foo = cgi#argument_value "foo" in
(it is present in my attached file, what happened???)
ChriS
The way it is, the script is NOT compiled, it is interpreted. I
recommend you compile it to bytecode
(http://caml.inria.fr/pub/docs/manual-ocaml/manual022.html) or native
code (http://caml.inria.fr/pub/docs/manual-ocaml/manual025.html)
however.
> jonathan@inner-sanctum:~/csi/ml$ ocamlrun ocaml ./demo.ml
> Cannot load required shared library dllpcre_stubs.
> Reason: dllpcre_stubs.so: cannot open shared object file: No such file or
> directory.
I do not have that problem (get Debian :). Does the script run from
the command line? Maybe setting the environment variable
LD_LIBRARY_PATH can help?
I propose to continue this conversation on the beginner mailing list
(http://groups.yahoo.com/group/ocaml_beginners/) to which I also sent
this message.
In a script, you can do:
#use "topfind";;
#require "pcre";;
at this point, it'll have loaded all the necessary .cma & .cmi files,
added path to the .cmi/.mli files to the search path, and also resolve
any dependencies.