From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id BF09ABB83 for ; Sat, 8 Jul 2006 17:05:02 +0200 (CEST) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.185]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k68F528p030734 for ; Sat, 8 Jul 2006 17:05:02 +0200 Received: by nf-out-0910.google.com with SMTP id d4so347742nfe for ; Sat, 08 Jul 2006 08:05:02 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=Z+UoyUzK13cGLwf+XkeIzqsx6rbKEfmwI8wcWS5vZSZGsrjxmdG7lKWosp8pbRzOjh5CGC1uxw/8o5cHi47XhtkKtFdkXPhIJ6G3BggOtD6ff44ON6iGzgzJGt/hFu/48Gzd/S/jfhDNgOJIMTvcMjBUtYBNKcPr0LrPSf7NPAM= Received: by 10.78.122.11 with SMTP id u11mr1124301huc; Sat, 08 Jul 2006 08:05:01 -0700 (PDT) Received: by 10.78.116.20 with HTTP; Sat, 8 Jul 2006 08:05:00 -0700 (PDT) Message-ID: Date: Sat, 8 Jul 2006 11:05:00 -0400 From: "Jonathan Hayward http://JonathansCorner.com" To: caml-list@yquem.inria.fr Subject: "Hello web" please MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_27447_17933859.1152371100863" X-j-chkmail-Score: MSGID : 44AFC99E.000 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 44AFC99E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 foo:01 syntax:01 syntax:01 artwork:98 artwork:98 undefined:01 undefined:01 defined:02 defined:02 library:03 library:03 stories:95 stories:95 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.9 required=5.0 tests=DNS_FROM_RFC_ABUSE,HTML_20_30, HTML_MESSAGE,RCVD_BY_IP autolearn=disabled version=3.0.3 ------=_Part_27447_17933859.1152371100863 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I'm trying to figure out how to use CamlGI with OCaml, and am for the moment working on hello world basics: for instance, how do I get ocaml to use a specific library? Could you send me a "Hello web" OCaml script that uses CamlGI and 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)? If I see the syntax for that, I think I will be in a position to start tinkering. -- ++ Jonathan Hayward, jonathan.hayward@pobox.com ** To see an award-winning website with stories, essays, artwork, ** games, and a four-dimensional maze, why not visit my home page? ** All of this is waiting for you at http://JonathansCorner.com ** If you'd like a Google Mail (gmail.com) account, please tell me! ------=_Part_27447_17933859.1152371100863 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I'm trying to figure out how to use CamlGI with OCaml, and am for the moment working on hello world basics: for instance, how do I get ocaml to use a specific library?

Could you send me a "Hello web" OCaml script that uses CamlGI and 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)?

If I see the syntax for that, I think I will be in a position to start tinkering.

--
++ Jonathan Hayward, jonathan.hayward@pobox.com
** To see an award-winning website with stories, essays, artwork,
** games, and a four-dimensional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com

** If you'd like a Google Mail ( gmail.com) account, please tell me! ------=_Part_27447_17933859.1152371100863-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 713F2BB83 for ; Sat, 8 Jul 2006 22:48:26 +0200 (CEST) Received: from hedwig1.umh.ac.be (hedwig2.umh.ac.be [193.190.193.73]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k68KmNAU019702 for ; Sat, 8 Jul 2006 22:48:26 +0200 Received: from poincare.swapping.umh.ac.be (pri-010.umh.ac.be [10.101.0.10]) by hedwig1.umh.ac.be (8.13.6/8.13.6) with ESMTP id k68KnrrH385076; Sat, 8 Jul 2006 22:49:53 +0200 Received: from localhost ([127.0.0.1]) by poincare.swapping.umh.ac.be with esmtp (Exim 4.62) (envelope-from ) id 1FzJiX-00078Z-1W; Sat, 08 Jul 2006 22:47:57 +0200 Date: Sat, 08 Jul 2006 22:47:56 +0200 (CEST) Message-Id: <20060708.224756.70330795.Christophe.Troestler@umh.ac.be> To: christos.jonathan.hayward@gmail.com Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] "Hello web" please From: Christophe TROESTLER In-Reply-To: References: X-Face: #2fb%mPx>rRL@4ff~TVgZ"<[:,oL"`TUEGK/[8/qb58~C>jR(x4A+v/n)7BgpEtIph_neoLKJBq0JBY9:}8v|j Organization: Universite de Mons-Hainaut (http://math.umh.ac.be/an/) X-Spook: BATF chameleon man gamma bootleg Rumsfeld Ft. Meade cypherpunk Mossad JSOFC3IP pink noise X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Operating-System: Debian GNU/Linux (http://www.debian.org/) X-Mailer: Mew version 4.2.52 on Emacs 22.0.50 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Sat_Jul__8_22_47_56_2006_159)--" Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.1 (www dot roaringpenguin dot com slash mimedefang) X-Miltered: at concorde with ID 44B01A17.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; christophe:01 troestler:01 christophe:01 troestler:01 umh:01 ocaml:01 netcgi:01 netcgi:01 ocamlnet-:01 foo:01 escaping:01 buffered:01 netencoding:01 encodes:01 foo:01 X-Attachments: name="hello.ml" X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 ----Next_Part(Sat_Jul__8_22_47_56_2006_159)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit On Sat, 8 Jul 2006, "Jonathan Hayward http://JonathansCorner.com" wrote: > > I'm trying to figure out how to use CamlGI with OCaml, [...] CamlGI code has been integrated into the Netcgi component of OcamlNet-2 , 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 ----Next_Part(Sat_Jul__8_22_47_56_2006_159)-- Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="hello.ml" open Netcgi let text = Netencoding.Html.encode_from_latin1 (* This function encodes "<", ">", "&", double quotes, and Latin 1 characters as character entities. E.g. text "<" = "<", and text "ä" = "ä" *) (* Normally you would use a template system instead of this *) let html_page (cgi:cgi) title html = let out = cgi#out_channel#output_string in out "\n"; out ("\n" ^ text title ^" \n"); out html; out "\n" let main (cgi:cgi) = cgi#set_header ~cache:`No_cache ~content_type:"text/html; charset=\"iso-8859-1\"" (); let foo = cgi#argument_value "foo" let html = match foo with | "1" -> "Yes" | "0" -> "No" | _ -> "Undefined" in html_page cgi foo html (* You can buffer or not the output. If buffered you can rollback (useful in case of error). You can replace Netcgi_cgi.run by another connector entry point (FCGI, SCGI, AJP, Apache mod). *) let () = let buffered _ ch = new Netchannels.buffered_trans_channel ch in Netcgi_cgi.run ~output_type:(`Transactional buffered) main ----Next_Part(Sat_Jul__8_22_47_56_2006_159)---- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 8AEF2BB84 for ; Mon, 10 Jul 2006 16:50:02 +0200 (CEST) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.185]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6AEo179006943 for ; Mon, 10 Jul 2006 16:50:02 +0200 Received: by nf-out-0910.google.com with SMTP id k26so6880nfc for ; Mon, 10 Jul 2006 07:49:59 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=CG8OzgFusSoQhkGacprd9js1hEjHB3VZFLRr3h+Q6iuli53asQjYE8+0+14VBdQMYAkByl6kR5kttjC1m1Qs5DwrqKKvXCySQwQsazIpf6Af0jILf6OBuBb8Uz2E57n1lLqmuhMDW5dz1WXhMmCp3Z5JpvteJyt9twT0GapV4as= Received: by 10.78.170.17 with SMTP id s17mr1716009hue; Mon, 10 Jul 2006 07:49:59 -0700 (PDT) Received: by 10.78.116.20 with HTTP; Mon, 10 Jul 2006 07:49:59 -0700 (PDT) Message-ID: Date: Mon, 10 Jul 2006 10:49:59 -0400 From: "Jonathan Hayward http://JonathansCorner.com" To: caml-list@yquem.inria.fr Subject: Re: "Hello web" please In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_9830_4925788.1152542999523" References: X-j-chkmail-Score: MSGID : 44B26919.001 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 44B26919.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; netcgi:01 ocamlnet-:01 ocamlnet-:01 tar:01 ocamlnet:01 pcre:01 pcre:01 netcgi:01 tar:01 ocamlnet:01 urged:98 artwork:98 urged:98 artwork:98 commented:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.9 required=5.0 tests=DNS_FROM_RFC_ABUSE,HTML_20_30, HTML_MESSAGE,RCVD_BY_IP autolearn=disabled version=3.0.3 ------=_Part_9830_4925788.1152542999523 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I've been urged to use Netcgi from OcamlNet-2 from http://www.ocaml-programming.de/packages/ocamlnet-2.2test2.tar.gz . 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. How can I install OcamlNet-2? Right now I'm stuck on getting it to recognize PCRE. -- ++ Jonathan Hayward, jonathan.hayward@pobox.com ** To see an award-winning website with stories, essays, artwork, ** games, and a four-dimensional maze, why not visit my home page? ** All of this is waiting for you at http://JonathansCorner.com ** If you'd like a Google Mail (gmail.com) account, please tell me! ------=_Part_9830_4925788.1152542999523 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I've been urged to use Netcgi from OcamlNet-2 from http://www.ocaml-programming.de/packages/ocamlnet-2.2test2.tar.gz .

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.

How can I install OcamlNet-2? Right now I'm stuck on getting it to recognize PCRE.

--
++ Jonathan Hayward, jonathan.hayward@pobox.com
** To see an award-winning website with stories, essays, artwork,
** games, and a four-dimensional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com

** If you'd like a Google Mail (gmail.com) account, please tell me! ------=_Part_9830_4925788.1152542999523-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id D30FCBB84 for ; Mon, 10 Jul 2006 17:02:07 +0200 (CEST) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.189]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6AF26KF009113 for ; Mon, 10 Jul 2006 17:02:07 +0200 Received: by nf-out-0910.google.com with SMTP id a25so681389nfc for ; Mon, 10 Jul 2006 08:02:04 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=N7oeMTYfDQ7HbZ5uast9qfI7Vtl409zqJk7HqtoLVcae4Wytrg006BfSUQlm3m/mJ/Za5MTZtBvyvniTM7vsoko7jbLkmsaZpx1nLJOtzgAfoBeYgLdzwJTJpOdK5vFaSJely3boEy37azZjuZKWJLdcIw0qEIxFGrcllwVMCSM= Received: by 10.78.157.15 with SMTP id f15mr1726548hue; Mon, 10 Jul 2006 08:02:03 -0700 (PDT) Received: by 10.78.116.20 with HTTP; Mon, 10 Jul 2006 08:02:02 -0700 (PDT) Message-ID: Date: Mon, 10 Jul 2006 11:02:02 -0400 From: "Jonathan Hayward http://JonathansCorner.com" To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] "Hello web" please In-Reply-To: <20060708.224756.70330795.Christophe.Troestler@umh.ac.be> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10263_26416646.1152543722971" References: <20060708.224756.70330795.Christophe.Troestler@umh.ac.be> X-j-chkmail-Score: MSGID : 44B26BEE.001 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 44B26BEE.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocamlnet:01 usr:01 ocaml:01 netcgi:01 netencoding:01 encodes:01 foo:01 foo:01 buffer:01 buffered:01 netcgi:01 buffered:01 netchannels:01 syntax:01 syntax:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.3 required=5.0 tests=DNS_FROM_RFC_ABUSE,HTML_30_40, HTML_MESSAGE,RCVD_BY_IP,RCVD_IN_BL_SPAMCOP_NET autolearn=disabled version=3.0.3 ------=_Part_10263_26416646.1152543722971 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I need help getting Ocamlnet to work at a basic level. I tried running the script from the command-like to more easily access diagnostic output. What should the shebang line say? Right now I have the following (mostly) paste of the demo script, plus shebang line; when I run it from within apache I get an internal server error. (A copy of the comman= d line output follows the script). -- #!/usr/local/bin/ocaml open Netcgi let text =3D Netencoding.Html.encode_from_latin1 (* This function encodes "<", ">", "&", double quotes, and Latin 1 characters as character entities. E.g. text "<" =3D "<", and text "=E4" =3D "ä" *) (* Normally you would use a template system instead of this *) let html_page (cgi:cgi) title html =3D let out =3D cgi#out_channel#output_string in out "\n"; out ("\n" ^ text title ^" \n"); out html; out "\n" let main (cgi:cgi) =3D cgi#set_header ~cache:`No_cache ~content_type:"text/html; charset=3D\"iso-8859-1\"" (); let foo =3D cgi#argument_value "foo" let html =3D match foo with | "1" -> "Yes" | "0" -> "No" | _ -> "Undefined" in html_page cgi foo html (* You can buffer or not the output. If buffered you can rollback (useful in case of error). You can replace Netcgi_cgi.run by another connector entry point (FCGI, SCGI, AJP, Apache mod). *) let () =3D let buffered _ ch =3D new Netchannels.buffered_trans_channel ch in Netcgi_cgi.run ~output_type:(`Transactional buffered) main -- Couldnt get a file descriptor referring to the console Could not get a file descriptor referring to the console ./demo.ml: line 4: let: =3D: syntax error: operand expected (error token is "=3D") ./demo.ml: line 5: demo.ml: command not found ./demo.ml: line 6: characters: command not found ./demo.ml: line 7: text: command not found ./demo.ml: line 9: demo.ml: command not found ./demo.ml: line 10: syntax error near unexpected token `(' ./demo.ml: line 10: `let html_page (cgi:cgi) title html =3D' -- On 7/8/06, Christophe TROESTLER wrote: > > On Sat, 8 Jul 2006, "Jonathan Hayward http://JonathansCorner.com" < > christos.jonathan.hayward@gmail.com> wrote: > > > > I'm trying to figure out how to use CamlGI with OCaml, [...] > > CamlGI code has been integrated into the Netcgi component > > of OcamlNet-2 , 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 > > > open Netcgi > > let text =3D Netencoding.Html.encode_from_latin1 > (* This function encodes "<", ">", "&", double quotes, and Latin 1 > characters as character entities. E.g. text "<" =3D "<", and > text "=E4" =3D "ä" *) > > (* Normally you would use a template system instead of this *) > let html_page (cgi:cgi) title html =3D > let out =3D cgi#out_channel#output_string in > out " \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"; > out ("\n" ^ text title ^" > \n"); > out html; > out "\n" > > let main (cgi:cgi) =3D > cgi#set_header > ~cache:`No_cache > ~content_type:"text/html; charset=3D\"iso-8859-1\"" > (); > let foo =3D cgi#argument_value "foo" > let html =3D match foo with > | "1" -> "Yes" > | "0" -> "No" > | _ -> "Undefined" in > html_page cgi foo html > > (* You can buffer or not the output. If buffered you can rollback > (useful in case of error). You can replace Netcgi_cgi.run by > another connector entry point (FCGI, SCGI, AJP, Apache mod). *) > let () =3D > let buffered _ ch =3D new Netchannels.buffered_trans_channel ch in > Netcgi_cgi.run ~output_type:(`Transactional buffered) main > > > --=20 ++ Jonathan Hayward, jonathan.hayward@pobox.com ** To see an award-winning website with stories, essays, artwork, ** games, and a four-dimensional maze, why not visit my home page? ** All of this is waiting for you at http://JonathansCorner.com ** If you'd like a Google Mail (gmail.com) account, please tell me! ------=_Part_10263_26416646.1152543722971 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I need help getting Ocamlnet to work at a basic level.

I tried running the script from the command-like to more easily access diagnostic output. What should the shebang line say? Right now I have the following (mostly) paste of the demo script, plus shebang line; when I run it from within apache I get an internal server error. (A copy of the command line output follows the script).

--

#!/usr/local/bin/ocaml
open Netcgi

let text =3D Netencoding.Html.encode_from_latin1
  (* This function encodes "<", ">", "&= amp;", double quotes, and Latin 1
     characters as character entities.  E.g. text = "<" =3D "&lt;", and
     text "=E4" =3D "&auml;" *)=

(* Normally you would use a template system instead of this *)
let html_page (cgi:cgi) title html =3D
  let out =3D cgi#out_channel#output_string in
  out "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0//EN\&= quot; \
        \" http://www.w3.org/TR/REC-html40/strict.dtd\= ">\n";
  out ("<html>\n<head><title>" ^ text titl= e ^"</title></head>
<body>\n");
  out html;
  out "</body>\n</html>"

let main (cgi:cgi) =3D
  cgi#set_header
    ~cache:`No_cache
    ~content_type:"text/html; charset=3D\"iso-8859= -1\""
    ();
  let foo =3D cgi#argument_value "foo"
  let html =3D match foo with
    | "1" -> "Yes"
    | "0" -> "No"
    | _ -> "Undefined" in
  html_page cgi foo html

(* You can buffer or not the output.  If buffered you can rollback
   (useful in case of error). You can replace Netcgi_cgi.run by    another connector entry point (FCGI, SCGI, AJP, Apache mod). *= )
let () =3D
  let buffered _ ch =3D new Netchannels.buffered_trans_channel ch in   Netcgi_cgi.run ~output_type:(`Transactional buffered) main


--

Couldnt get a file descriptor referring to the console
Could not get a file descriptor referring to the console
./demo.ml: line 4: let: =3D: syntax error: operand expected (error token is= "=3D")
./demo.ml: line 5: demo.ml: command not foun= d
./demo.ml: line 6: characters: command not found
./demo.ml: line 7: text: command not found
./demo.ml: line 9: demo.ml: command not foun= d
./demo.ml: line 10: syntax error near unexpected token `('
./demo.ml: line 10: `let html_page (cgi:cgi) title html =3D'


--

On 7/8/06, Christophe TROESTLER <Christophe.Troestler@umh.ac.be> wrote: On Sat, 8 Jul 2006, "Jonathan Hayward http://JonathansCorner.com" <christos.jonathan.hayward@gmail.com> wro= te:
>
> I'm trying to figure out how to use CamlGI with OCaml, [..= .]

CamlGI code has been integrated into the Netcgi component
<= https://gps.dynxs.de/wwwsvn/trunk/code/src/netcgi/?root=3Dlib-ocamlnet2= >
of OcamlNet-2 <https://gps.dynxs.de/openapps/svnindex.cgi>, please use
tha= t 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 e= xamples/ directory (add.ml is a very
simpl= e one).  As for the specific example you desire, it is attached.<= br>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


open Netcgi
let text =3D Netencoding.Html.encode_from_latin1
  (* Thi= s function encodes "<", ">", "&", d= ouble quotes, and Latin 1
     characters as character entities.  E= .g. text "<" =3D "&lt;", and
  &nbs= p;  text "=E4" =3D "&auml;" *)

(* Norma= lly you would use a template system instead of this *)
let html_page (cgi:cgi) title html =3D
  let out =3D cgi#o= ut_channel#output_string in
  out "<!DOCTYPE html PUBL= IC \"-//W3C//DTD HTML 4.0//EN\" \
    &nbs= p;   \" http://www.w3.org/TR/REC-html40/strict.dtd\">\n";
 = ; out ("<html>\n<head><title>" ^ text titl= e ^"</title></head>
<body>\n");
 &nb= sp;out html;
  out "</body>\n</html>"

let main (c= gi:cgi) =3D
  cgi#set_header
    ~cache= :`No_cache
    ~content_type:"text/html; charse= t=3D\"iso-8859-1\""
    ();
 =  let foo =3D cgi#argument_value "foo"
  let html =3D match foo with
    | &q= uot;1" -> "Yes"
    | "0"= ; -> "No"
    | _ -> "Undefined= " in
  html_page cgi foo html

(* You can buffer or= not the output.  If buffered you can rollback
   (useful in case of error). You can replace Netcgi_cgi.run = by
   another connector entry point (FCGI, SCGI, AJP, Apache m= od). *)
let () =3D
  let buffered _ ch =3D new Netchannels.= buffered_trans_channel ch in
  Netcgi_cgi.run ~output_type:(`Transactional buffered) main
<= br>



--
++ Jonathan Hayw= ard, jonathan.hayward@pobox.c= om
** To see an award-winning website with stories, essays, artwork,
** gam= es, and a four-dimensional maze, why not visit my home page?
** All of t= his is waiting for you at http://Jon= athansCorner.com

** If you'd like a Google Mail (gm= ail.com) account, please tell me! ------=_Part_10263_26416646.1152543722971-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id A01A9BB84 for ; Mon, 10 Jul 2006 17:14:36 +0200 (CEST) Received: from hedwig1.umh.ac.be (hedwig2.umh.ac.be [193.190.193.73]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6AFEa2c012121 for ; Mon, 10 Jul 2006 17:14:36 +0200 Received: from poincare.swapping.umh.ac.be (mathwifi.swapping.umh.ac.be [10.102.100.203]) by hedwig1.umh.ac.be (8.13.6/8.13.6) with ESMTP id k6AFGJXk933946; Mon, 10 Jul 2006 17:16:19 +0200 Received: from localhost ([127.0.0.1]) by poincare.swapping.umh.ac.be with esmtp (Exim 4.62) (envelope-from ) id 1FzxSo-0003TA-D4; Mon, 10 Jul 2006 17:14:22 +0200 Date: Mon, 10 Jul 2006 17:14:22 +0200 (CEST) Message-Id: <20060710.171422.95476376.Christophe.Troestler@umh.ac.be> To: christos.jonathan.hayward@gmail.com Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: "Hello web" please From: Christophe TROESTLER In-Reply-To: References: X-Face: #2fb%mPx>rRL@4ff~TVgZ"<[:,oL"`TUEGK/[8/qb58~C>jR(x4A+v/n)7BgpEtIph_neoLKJBq0JBY9:}8v|j Organization: Universite de Mons-Hainaut (http://math.umh.ac.be/an/) X-Spook: plutonium Compsec industrial espionage Guantanamo USCODE Janet Reno Legion of Doom Aladdin SDI beanpole X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Operating-System: Debian GNU/Linux (http://www.debian.org/) X-Mailer: Mew version 4.2.52 on Emacs 22.0.50 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.1 (www dot roaringpenguin dot com slash mimedefang) X-j-chkmail-Score: MSGID : 44B26EDC.000 on nez-perce : j-chkmail score : XXXXX : 10/20 0 X-Miltered: at nez-perce with ID 44B26EDC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; christophe:01 troestler:01 christophe:01 troestler:01 umh:01 netcgi:01 ocamlnet-:01 ocamlnet-:01 tar:01 ocamlnet:01 pcre:01 pcre:01 ocaml:01 ocaml:01 urged:98 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=INFO_TLD autolearn=disabled version=3.0.3 On Mon, 10 Jul 2006, "Jonathan Hayward http://JonathansCorner.com" wrote: > > I've been urged to use Netcgi from OcamlNet-2 from > http://www.ocaml-programming.de/packages/ocamlnet-2.2test2.tar.gz . 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 4774CBB84 for ; Mon, 10 Jul 2006 17:48:26 +0200 (CEST) Received: from hedwig1.umh.ac.be (hedwig2.umh.ac.be [193.190.193.73]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k6AFmLCc015400 for ; Mon, 10 Jul 2006 17:48:26 +0200 Received: from poincare.swapping.umh.ac.be (mathwifi.swapping.umh.ac.be [10.102.100.203]) by hedwig1.umh.ac.be (8.13.6/8.13.6) with ESMTP id k6AFo8871245392; Mon, 10 Jul 2006 17:50:08 +0200 Received: from localhost ([127.0.0.1]) by poincare.swapping.umh.ac.be with esmtp (Exim 4.62) (envelope-from ) id 1FzxzX-0003mO-9b; Mon, 10 Jul 2006 17:48:11 +0200 Date: Mon, 10 Jul 2006 17:48:00 +0200 (CEST) Message-Id: <20060710.174800.180966261.Christophe.Troestler@umh.ac.be> To: christos.jonathan.hayward@gmail.com Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] "Hello web" please From: Christophe TROESTLER In-Reply-To: References: <20060708.224756.70330795.Christophe.Troestler@umh.ac.be> X-Face: #2fb%mPx>rRL@4ff~TVgZ"<[:,oL"`TUEGK/[8/qb58~C>jR(x4A+v/n)7BgpEtIph_neoLKJBq0JBY9:}8v|j Organization: Universite de Mons-Hainaut (http://math.umh.ac.be/an/) X-Spook: ANDVT espionage cracking Kh-11 kilo class Ft. Meade Mossad terrorist target industrial espionage X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Operating-System: Debian GNU/Linux (http://www.debian.org/) X-Mailer: Mew version 4.2.52 on Emacs 22.0.50 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Mon_Jul_10_17_48_00_2006_040)--" Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.1 (www dot roaringpenguin dot com slash mimedefang) X-Miltered: at concorde with ID 44B276C5.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; christophe:01 troestler:01 christophe:01 troestler:01 umh:01 usr:01 ocaml:01 usr:01 ocamlrun:01 ocaml:01 pcre:01 unix:01 netcgi:01 netcgi:01 tarball:01 X-Attachments: name="script.ml" X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 ----Next_Part(Mon_Jul_10_17_48_00_2006_040)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit On Mon, 10 Jul 2006, "Jonathan Hayward http://JonathansCorner.com" wrote: > > What should the shebang line say? > #!/usr/local/bin/ocaml #!/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 ----Next_Part(Mon_Jul_10_17_48_00_2006_040)-- Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="script.ml" #!/usr/bin/ocamlrun ocaml (* Change the directories as needed for your system. *) #directory "+pcre";; #load "pcre.cma";; #load "unix.cma";; #directory "+netstring";; #load "netstring.cma";; #directory "/path/to/netcgi/";; #load "netcgi.cma";; open Netcgi let text = Netencoding.Html.encode_from_latin1 (* This function encodes "<", ">", "&", double quotes, and Latin 1 characters as character entities. E.g. text "<" = "<", and text "ä" = "ä" *) (* Normally you would use a template system instead of this *) let html_page (cgi:cgi) title html = let out = cgi#out_channel#output_string in out "\n"; out ("\n" ^ text title ^" \n"); out html; out "\n" let main (cgi:cgi) = cgi#set_header ~cache:`No_cache ~content_type:"text/html; charset=\"iso-8859-1\"" (); let foo = cgi#argument_value "foo" in let html = match foo with | "1" -> "Yes" | "0" -> "No" | _ -> "Undefined" in html_page cgi foo html (* You can buffer or not the output. If buffered you can rollback (useful in case of error). You can replace Netcgi_cgi.run by another connector entry point (FCGI, SCGI, AJP, Apache mod). *) let () = let buffered _ ch = new Netchannels.buffered_trans_channel ch in Netcgi_cgi.run ~output_type:(`Transactional buffered) main ----Next_Part(Mon_Jul_10_17_48_00_2006_040)---- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id C0B48BB84 for ; Mon, 10 Jul 2006 17:51:26 +0200 (CEST) Received: from nz-out-0102.google.com (nz-out-0102.google.com [64.233.162.195]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6AFpPa4018542 for ; Mon, 10 Jul 2006 17:51:26 +0200 Received: by nz-out-0102.google.com with SMTP id z3so1342455nzf for ; Mon, 10 Jul 2006 08:51:23 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gcIoZ8ADD71BAxxzockrK30mbHz90h+8tFoLccowiEZd+IanYW+ss4Ea7od1e4k8UD/DL2xoCpv1cbWhOUmPspFcBs2Y5ojtHsrNxDzzaJs4WBvL+qxlHKEYvHO/TxoR1exbDLi4tcEj59FSUjXTH2aY8xZHYmnd423vlS5A8Gg= Received: by 10.36.50.17 with SMTP id x17mr5753528nzx; Mon, 10 Jul 2006 08:51:23 -0700 (PDT) Received: by 10.36.101.10 with HTTP; Mon, 10 Jul 2006 08:51:23 -0700 (PDT) Message-ID: Date: Tue, 11 Jul 2006 03:51:23 +1200 From: "Jonathan Roewen" To: "Jonathan Hayward http://JonathansCorner.com" Subject: Re: [Caml-list] "Hello web" please Cc: caml-list@yquem.inria.fr In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20060708.224756.70330795.Christophe.Troestler@umh.ac.be> X-j-chkmail-Score: MSGID : 44B2777D.001 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 44B2777D.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; usr:01 ocaml:01 usr:01 ocamlrun:01 ocaml:01 caml-list:01 bin:01 bin:01 might:10 some:13 local:15 local:15 hello:17 try:18 what:23 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=DNS_FROM_RFC_ABUSE,RCVD_BY_IP autolearn=disabled version=3.0.3 > #!/usr/local/bin/ocaml you might want to try: #!/usr/local/bin/ocamlrun ocaml This is what I had to do with my webhost for some reason. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 822B6BB84 for ; Tue, 11 Jul 2006 16:23:26 +0200 (CEST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.171]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6BENP6E013656 for ; Tue, 11 Jul 2006 16:23:26 +0200 Received: by ug-out-1314.google.com with SMTP id j3so3664579ugf for ; Tue, 11 Jul 2006 07:23:25 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=Su/dgv60XfyAFvJFkHZTbawc6nrQVUrvbXt6zZxu48ISrJqso03LcKwK0VFlgJxV6zjh4ImuqJjFiTh035ZAG8LMotbx4zMpdCTfdCMAVSinXGoWeQ96xrrrvlA03SSHSytptGCgncwpkhyx54av0et8iG1lhSZXtr6ORYXNaB0= Received: by 10.78.136.7 with SMTP id j7mr2169363hud; Tue, 11 Jul 2006 07:23:25 -0700 (PDT) Received: by 10.78.116.20 with HTTP; Tue, 11 Jul 2006 07:23:24 -0700 (PDT) Message-ID: Date: Tue, 11 Jul 2006 10:23:24 -0400 From: "Jonathan Hayward http://JonathansCorner.com" To: "Christophe TROESTLER" Subject: Re: [Caml-list] "Hello web" please Cc: caml-list@yquem.inria.fr In-Reply-To: <20060710.174800.180966261.Christophe.Troestler@umh.ac.be> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_16959_31410365.1152627804694" References: <20060708.224756.70330795.Christophe.Troestler@umh.ac.be> <20060710.174800.180966261.Christophe.Troestler@umh.ac.be> X-j-chkmail-Score: MSGID : 44B3B45D.000 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 44B3B45D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; usr:01 lib:01 ocaml:01 3.08.3:01 netcgi:01 netcgi:01 cmi:01 mli:01 jserv:01 cmi:01 mli:01 jserv:01 cmxa:01 syntax:01 syntax:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=DNS_FROM_RFC_ABUSE,HTML_40_50, HTML_MESSAGE,RCVD_BY_IP autolearn=disabled version=3.0.3 ------=_Part_16959_31410365.1152627804694 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I now have the script below. I was slightly surprised it didn't get an erro= r as I had it load /usr/lib/ocaml/3.08.3/cgi/netcgi.cma, and the directory contains: cgi.a netcgi_env.cmi netcgi_fcgi.mli netcgi_jserv.cmi cgi.cma netcgi_env.mli netcgi_jserv_ajp12.cmi netcgi_jserv.mli cgi.cmxa netcgi_fcgi_10.cmi netcgi_jserv_ajp12.mli netcgi.mli META netcgi_fcgi_10.mli netcgi_jserv_app.cmi netcgi_types.cmi netcgi.cmi netcgi_fcgi.cmi netcgi_jserv_app.mli netcgi_types.mli When I run it, I get a different and shorter error message: File "./demo.ml", line 35, characters 2-5: Syntax error The line in question is: | "1" -> "Yes" Is there some irritating little syntax error around line 35? -- #!/usr/bin/ocamlrun ocaml (* Change the directories as needed for your system. *) #directory "+pcre";; #load "pcre.cma";; #load "unix.cma";; #directory "+netstring";; #load "netstring.cma";; #directory "/usr/lib/ocaml/3.08.3/cgi/";; #load "netcgi.cma";; open Netcgi let text =3D Netencoding.Html.encode_from_latin1 (* This function encodes "<", ">", "&", double quotes, and Latin 1 characters as character entities. E.g. text "<" =3D "<", and text "=E4" =3D "ä" *) (* Normally you would use a template system instead of this *) let html_page (cgi:cgi) title html =3D let out =3D cgi#out_channel#output_string in out "\n"; out ("\n" ^ text title ^" \n"); out html; out "\n" let main (cgi:cgi) =3D cgi#set_header ~cache:`No_cache ~content_type:"text/html; charset=3D\"iso-8859-1\"" (); let foo =3D cgi#argument_value "foo" let html =3D match foo with | "1" -> "Yes" | "0" -> "No" | _ -> "Undefined" in html_page cgi foo html (* You can buffer or not the output. If buffered you can rollback (useful in case of error). You can replace Netcgi_cgi.run by another connector entry point (FCGI, SCGI, AJP, Apache mod). *) let () =3D let buffered _ ch =3D new Netchannels.buffered_trans_channel ch in Netcgi_cgi.run ~output_type:(`Transactional buffered) main --=20 ++ Jonathan Hayward, jonathan.hayward@pobox.com ** To see an award-winning website with stories, essays, artwork, ** games, and a four-dimensional maze, why not visit my home page? ** All of this is waiting for you at http://JonathansCorner.com ** If you'd like a Google Mail (gmail.com) account, please tell me! ------=_Part_16959_31410365.1152627804694 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I now have the script below. I was slightly surprised it didn't get an error as I had it load /usr/lib/ocaml/3.08.3/cgi/netcgi.cma, and the directory contains:

cgi.a   =     netcgi_env.cmi      netcgi_fcgi.mli         netcgi_jserv.cmi
cgi.cma     netcgi_env.mli     = ; netcgi_jserv_ajp12.cmi  netcgi_jserv.mli
cgi.cmxa    netcgi_fcgi_10.cmi  netcgi_jserv_ajp12.mli&= nbsp; netcgi.mli
META        netcgi_fcgi_10.mli  net= cgi_jserv_app.cmi    netcgi_types.cmi
netcgi.cmi  netcgi_fcgi.cmi     netcgi_jserv_app.m= li    netcgi_types.mli




When I run it, I get a different and shorter error message:

File "./demo.ml", line 35, characters 2-5:
Syntax error

The line in question is:

    | "1" -> "Yes"

Is there some irritating little syntax error around line 35?

--

#!/usr/bin/ocamlrun ocaml

(* Change the directories as needed for your system. *)
#directory "+pcre";;
#load "pcre.cma";;
#load "unix.cma";;
#directory "+netstring";;
#load "netstring.cma";;
#directory "/usr/lib/ocaml/3.08.3/cgi/";;
#load "netcgi.cma";;

open Netcgi

let text =3D Netencoding.Html.encode_from_latin1
  (* This function encodes "<", ">", "&= amp;", double quotes, and Latin 1
     characters as character entities.  E.g. text = "<" =3D "&lt;", and
     text "=E4" =3D "&auml;" *)=

(* Normally you would use a template system instead of this *)
let html_page (cgi:cgi) title html =3D
  let out =3D cgi#out_channel#output_string in
  out "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0//EN\&= quot; \
        \" http://www.w3.org/TR/REC-html40/strict.dtd\= ">\n";
  out ("<html>\n<head><title>" ^ text titl= e ^"</title></head>
<body>\n");
  out html;
  out "</body>\n</html>"

let main (cgi:cgi) =3D
  cgi#set_header
    ~cache:`No_cache
    ~content_type:"text/html; charset=3D\"iso-8859= -1\""
    ();
  let foo =3D cgi#argument_value "foo"
  let html =3D match foo with
    | "1" -> "Yes"
    | "0" -> "No"
    | _ -> "Undefined" in
  html_page cgi foo html

(* You can buffer or not the output.  If buffered you can rollback
   (useful in case of error). You can replace Netcgi_cgi.run by    another connector entry point (FCGI, SCGI, AJP, Apache mod). *= )
let () =3D
  let buffered _ ch =3D new Netchannels.buffered_trans_channel ch in   Netcgi_cgi.run ~output_type:(`Transactional buffered) main


--
++ Jonathan Hayward, jonathan.hayward@pobox.com
** To see an award-w= inning website with stories, essays, artwork,
** games, and a four-dimen= sional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com

** If you'd like a Google Mail (= gmail.com) account, please tell me! ------=_Part_16959_31410365.1152627804694-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 462ECBBBC for ; Tue, 11 Jul 2006 16:33:38 +0200 (CEST) Received: from tintin.inria.fr (tintin.inria.fr [128.93.24.126]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k6BEXbw9023521 for ; Tue, 11 Jul 2006 16:33:38 +0200 Date: Tue, 11 Jul 2006 16:33:37 +0200 From: Maxence Guesdon To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] "Hello web" please Message-ID: <20060711163337.19cf0071@tintin.inria.fr> In-Reply-To: References: <20060708.224756.70330795.Christophe.Troestler@umh.ac.be> <20060710.174800.180966261.Christophe.Troestler@umh.ac.be> Organization: INRIA X-Mailer: Sylpheed-Claws 2.0.0 (GTK+ 2.4.9; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-j-chkmail-Score: MSGID : 44B3B6C1.002 on concorde : j-chkmail score : X : 0/20 1 X-Miltered: at concorde with ID 44B3B6C1.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; maxence:01 guesdon:01 maxence:01 guesdon:01 foo:01 foo:01 2006:98 caml-list:01 argument:01 let:03 let:03 jul:04 inria:06 inria:06 rocq:06 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Tue, 11 Jul 2006 10:23:24 -0400 "Jonathan Hayward http://JonathansCorner.com" >... 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/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 51C84BBAF for ; Tue, 11 Jul 2006 16:43:02 +0200 (CEST) Received: from hedwig1.umh.ac.be (hedwig2.umh.ac.be [193.190.193.73]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k6BEgwLg026433 for ; Tue, 11 Jul 2006 16:43:02 +0200 Received: from poincare.swapping.umh.ac.be (mathwifi.swapping.umh.ac.be [10.102.100.203]) by hedwig1.umh.ac.be (8.13.6/8.13.6) with ESMTP id k6BEimZ62412684; Tue, 11 Jul 2006 16:44:48 +0200 Received: from localhost ([127.0.0.1]) by poincare.swapping.umh.ac.be with esmtp (Exim 4.62) (envelope-from ) id 1G0JRp-0002ux-VF; Tue, 11 Jul 2006 16:42:50 +0200 Date: Tue, 11 Jul 2006 16:42:49 +0200 (CEST) Message-Id: <20060711.164249.72518146.Christophe.Troestler@umh.ac.be> To: christos.jonathan.hayward@gmail.com Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] "Hello web" please From: Christophe TROESTLER In-Reply-To: References: <20060710.174800.180966261.Christophe.Troestler@umh.ac.be> X-Face: #2fb%mPx>rRL@4ff~TVgZ"<[:,oL"`TUEGK/[8/qb58~C>jR(x4A+v/n)7BgpEtIph_neoLKJBq0JBY9:}8v|j Organization: Universite de Mons-Hainaut (http://math.umh.ac.be/an/) X-Spook: ASIO Hugo Chavez Glock Sundevil bce Albanian Zachawi JFK Ansar al-Islam SAPO X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Operating-System: Debian GNU/Linux (http://www.debian.org/) X-Mailer: Mew version 4.2.52 on Emacs 22.0.50 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.1 (www dot roaringpenguin dot com slash mimedefang) X-Miltered: at concorde with ID 44B3B8F2.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; christophe:01 troestler:01 christophe:01 troestler:01 umh:01 syntax:01 syntax:01 foo:01 foo:01 suppresses:98 wrote:01 caml-list:01 argument:01 argument:01 let:03 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Tue, 11 Jul 2006, "Jonathan Hayward http://JonathansCorner.com" wrote: > > File "./demo.ml", line 35, characters 2-5: > Syntax error > > The line in question is: > > | "1" -> "Yes" > > Is there some irritating little syntax error around line 35? 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id AF596BB84 for ; Tue, 11 Jul 2006 19:40:02 +0200 (CEST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6BHe1Oj017190 for ; Tue, 11 Jul 2006 19:40:02 +0200 Received: by ug-out-1314.google.com with SMTP id j3so3760973ugf for ; Tue, 11 Jul 2006 10:40:01 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=fSZlBV4k3qXmnfArX0PGCq85zexsQlFa4yoLlHWLYZt+8/jNoNnRHMVljxuaIsoa79R80Pa9FJJcWzRPVMvTGl37Iv+3BuCO/cs4FigjBUqOaOVBjZVa//ojzZLabU5ER5Eh465ABhYsO1xmhCFnLV9xydrNiuhZM+pwyaVoXjg= Received: by 10.78.166.7 with SMTP id o7mr2291581hue; Tue, 11 Jul 2006 10:40:01 -0700 (PDT) Received: by 10.78.116.20 with HTTP; Tue, 11 Jul 2006 10:40:01 -0700 (PDT) Message-ID: Date: Tue, 11 Jul 2006 13:40:01 -0400 From: "Jonathan Hayward http://JonathansCorner.com" To: "Christophe TROESTLER" Subject: Re: [Caml-list] "Hello web" please Cc: caml-list@yquem.inria.fr In-Reply-To: <20060711.164249.72518146.Christophe.Troestler@umh.ac.be> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_173_1923638.1152639601298" References: <20060710.174800.180966261.Christophe.Troestler@umh.ac.be> <20060711.164249.72518146.Christophe.Troestler@umh.ac.be> X-j-chkmail-Score: MSGID : 44B3E271.002 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 44B3E271.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; runtime:01 ocamlrun:01 ocaml:01 dllpcre:01 stubs:01 dllpcre:01 stubs:01 pcre':01 usr:01 lib:01 ocaml:01 3.08.3:01 stublibs:01 usr:01 ocamlrun:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=DNS_FROM_RFC_ABUSE,HTML_30_40, HTML_MESSAGE,RCVD_BY_IP autolearn=disabled version=3.0.3 ------=_Part_173_1923638.1152639601298 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thank you; it seems to compile now, but it's crashing (runtime); there's a library installed on my system that it's not picking up. The error message is: 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. Reference to undefined global `Pcre' jonathan@inner-sanctum:~/csi/ml$ Slocate finds the library in /usr/lib/ocaml/3.08.3/stublibs/dllpcre_stubs.s= o ; do I need to tell the script to search there? The script (missing " in" appended to the appropriate line) is: #!/usr/bin/ocamlrun ocaml (* Change the directories as needed for your system. *) #directory "/usr/lib/ocaml/3.08.3/pcre";; #load "pcre.cma";; #load "unix.cma";; #directory "/usr/lib/ocaml/3.08.3/netstring";; #load "netstring.cma";; #directory "/usr/lib/ocaml/3.08.3/cgi/";; #load "netcgi.cma";; open Netcgi let text =3D Netencoding.Html.encode_from_latin1 (* This function encodes "<", ">", "&", double quotes, and Latin 1 characters as character entities. E.g. text "<" =3D "<", and text "=E4" =3D "ä" *) (* Normally you would use a template system instead of this *) let html_page (cgi:cgi) title html =3D let out =3D cgi#out_channel#output_string in out "\n"; out ("\n" ^ text title ^" \n"); out html; out "\n" let main (cgi:cgi) =3D cgi#set_header ~cache:`No_cache ~content_type:"text/html; charset=3D\"iso-8859-1\"" (); let foo =3D cgi#argument_value "foo" in let html =3D match foo with | "1" -> "Yes" | "0" -> "No" | _ -> "Undefined" in html_page cgi foo html (* You can buffer or not the output. If buffered you can rollback (useful in case of error). You can replace Netcgi_cgi.run by another connector entry point (FCGI, SCGI, AJP, Apache mod). *) let () =3D let buffered _ ch =3D new Netchannels.buffered_trans_channel ch in Netcgi_cgi.run ~output_type:(`Transactional buffered) main -- --=20 ++ Jonathan Hayward, jonathan.hayward@pobox.com ** To see an award-winning website with stories, essays, artwork, ** games, and a four-dimensional maze, why not visit my home page? ** All of this is waiting for you at http://JonathansCorner.com ** If you'd like a Google Mail (gmail.com) account, please tell me! ------=_Part_173_1923638.1152639601298 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thank you; it seems to compile now, but it's crashing (runtime); there's a library installed on my system that it's not picking up.

The error message is:

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 d= irectory.
Reference to undefined global `Pcre'
jonathan@inner-sanctum:~/csi/ml$

Slocate finds the library in /usr/lib/ocaml/3.08.3/stublibs/dllpcre_stubs.s= o ; do I need to tell the script to search there?

The script (missing " in" appended to the appropriate line) is:
#!/usr/bin/ocamlrun ocaml

(* Change the directories as needed for your system. *)
#directory "/usr/lib/ocaml/3.08.3/pcre";;
#load "pcre.cma";;
#load "unix.cma";;
#directory "/usr/lib/ocaml/3.08.3/netstring";;
#load "netstring.cma";;
#directory "/usr/lib/ocaml/3.08.3/cgi/";;
#load "netcgi.cma";;

open Netcgi

let text =3D Netencoding.Html.encode_from_latin1
  (* This function encodes "<", ">", "&= amp;", double quotes, and Latin 1
     characters as character entities.  E.g. text = "<" =3D "&lt;", and
     text "=E4" =3D "&auml;" *)=

(* Normally you would use a template system instead of this *)
let html_page (cgi:cgi) title html =3D
  let out =3D cgi#out_channel#output_string in
  out "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0//EN\&= quot; \
        \" http://www.w3.org/TR/REC-html40/strict.dtd\= ">\n";
  out ("<html>\n<head><title>" ^ text titl= e ^"</title></head>
<body>\n");
  out html;
  out "</body>\n</html>"

let main (cgi:cgi) =3D
  cgi#set_header
    ~cache:`No_cache
    ~content_type:"text/html; charset=3D\"iso-8859= -1\""
    ();
  let foo =3D cgi#argument_value "foo" in
  let html =3D match foo with
    | "1" -> "Yes"
    | "0" -> "No"
    | _ -> "Undefined" in
  html_page cgi foo html

(* You can buffer or not the output.  If buffered you can rollback
   (useful in case of error). You can replace Netcgi_cgi.run by    another connector entry point (FCGI, SCGI, AJP, Apache mod). *= )
let () =3D
  let buffered _ ch =3D new Netchannels.buffered_trans_channel ch in   Netcgi_cgi.run ~output_type:(`Transactional buffered) main

--



--
++ Jonathan Hayward, jonathan.hayward@pobox.com
** To see an award-w= inning website with stories, essays, artwork,
** games, and a four-dimen= sional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com

** If you'd like a Google Mail (= gmail.com) account, please tell me! ------=_Part_173_1923638.1152639601298-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 642E2BB84 for ; Tue, 11 Jul 2006 20:14:44 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k6BIEhlT005722 for ; Tue, 11 Jul 2006 20:14:43 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA15326 for ; Tue, 11 Jul 2006 20:14:43 +0200 (MET DST) Received: from hedwig1.umh.ac.be (hedwig2.umh.ac.be [193.190.193.73]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6BIEeKf022123 for ; Tue, 11 Jul 2006 20:14:42 +0200 Received: from poincare.swapping.umh.ac.be (mathwifi.swapping.umh.ac.be [10.102.100.203]) by hedwig1.umh.ac.be (8.13.6/8.13.6) with ESMTP id k6BIGRnI1446050; Tue, 11 Jul 2006 20:16:28 +0200 Received: from localhost ([127.0.0.1]) by poincare.swapping.umh.ac.be with esmtp (Exim 4.62) (envelope-from ) id 1G0Mkf-0004gZ-He; Tue, 11 Jul 2006 20:14:29 +0200 Date: Tue, 11 Jul 2006 20:14:29 +0200 (CEST) Message-Id: <20060711.201429.245541912.Christophe.Troestler@umh.ac.be> To: christos.jonathan.hayward@gmail.com Cc: "O'Caml Beginners Mailing List" , "O'Caml Mailing List" Subject: Re: [Caml-list] "Hello web" please From: Christophe TROESTLER In-Reply-To: References: <20060711.164249.72518146.Christophe.Troestler@umh.ac.be> X-Face: #2fb%mPx>rRL@4ff~TVgZ"<[:,oL"`TUEGK/[8/qb58~C>jR(x4A+v/n)7BgpEtIph_neoLKJBq0JBY9:}8v|j Organization: Universite de Mons-Hainaut (http://math.umh.ac.be/an/) X-Spook: hackers Manfurov offensive information warfare MDA Saddam Hussein MD2 cracking AMW Ft. Meade SCUD missile X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Operating-System: Debian GNU/Linux (http://www.debian.org/) X-Mailer: Mew version 4.2.52 on Emacs 22.0.50 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.1 (www dot roaringpenguin dot com slash mimedefang) X-Miltered: at concorde with ID 44B3EA93.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44B3EA90.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; christophe:01 troestler:01 christophe:01 troestler:01 umh:01 runtime:01 bytecode:01 ocamlrun:01 ocaml:01 dllpcre:01 stubs:01 dllpcre:01 stubs:01 ocaml:01 beginners:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Tue, 11 Jul 2006, "Jonathan Hayward" wrote: > > Thank you; it seems to compile now, but it's crashing (runtime); there's a > library installed on my system that it's not picking up. 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. ChriS From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 36214BBAF for ; Tue, 11 Jul 2006 22:35:23 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k6BKZMlQ031464 for ; Tue, 11 Jul 2006 22:35:22 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA17320 for ; Tue, 11 Jul 2006 22:35:22 +0200 (MET DST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6BKZLMG010897 for ; Tue, 11 Jul 2006 22:35:21 +0200 Received: by ug-out-1314.google.com with SMTP id o2so1610420uge for ; Tue, 11 Jul 2006 13:35:21 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=QJ0Qf/S8oHFZlVJfhSGQtUbYl0vMU8cYdjDbHLXZ7GT1yEP4CsM45rk503H0AozDs0Rwfp+k0rV5D9ekxSKP7AgMmfRr4325x0Tr4XV2BGGN04aq8P9Mayo4gItqXg3geg0mxljpMMR0b3/bFvx7+DkcebyDsBTjtJYrnrq9hZs= Received: by 10.78.170.17 with SMTP id s17mr33053hue; Tue, 11 Jul 2006 13:35:20 -0700 (PDT) Received: by 10.78.116.20 with HTTP; Tue, 11 Jul 2006 13:35:20 -0700 (PDT) Message-ID: Date: Tue, 11 Jul 2006 16:35:20 -0400 From: "Jonathan Hayward http://JonathansCorner.com" To: "Christophe TROESTLER" Subject: Re: [Caml-list] "Hello web" please Cc: caml-list@inria.fr In-Reply-To: <20060711.201429.245541912.Christophe.Troestler@umh.ac.be> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6440_24151275.1152650120425" References: <20060711.164249.72518146.Christophe.Troestler@umh.ac.be> <20060711.201429.245541912.Christophe.Troestler@umh.ac.be> X-j-chkmail-Score: MSGID : 44B40B89.000 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at concorde with ID 44B40B8A.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44B40B89.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 beginners:01 usr:01 lib:01 ocaml:01 3.08.3:01 netstring:01 netstring:01 mismatch:01 usr:01 lib:01 3.08.3:01 mismatch:01 pcre:01 pcre:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=HTML_20_30,HTML_MESSAGE, RCVD_BY_IP autolearn=disabled version=3.0.3 ------=_Part_6440_24151275.1152650120425 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline > > 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. Sounds like a good idea; I'm waiting for my registration to be processed. In the meantime, I'd really like to have this working soon, and am having more trouble than I've had getting a first basic program working (in Python, Perl, Java, etc.), and be on to asking real questions instead of "How do I get this to run?" At the moment I get: jonathan@inner-sanctum:~/csi/ml$ !. ./demo.ml Error while loading "/usr/lib/ocaml/3.08.3/netstring/netstring.cma": interface mismatch on Filename Error while loading "/usr/lib/ocaml/3.08.3/netstring/netstring.cma": interface mismatch on Filename. Preprocessor error The segment of the script that I think is responsible for this is: #directory "/usr/lib/ocaml/3.08.3/pcre";; #load "pcre.cma";; #directory "/usr/lib/ocaml/3.08.3";; #load "unix.cma";; #directory "/usr/lib/ocaml/3.08.3/netstring";; #load "netstring.cma";; #directory "/usr/lib/ocaml/3.08.3/cgi/";; #load "netcgi.cma";; The directory it's looking for netstring contains the following files (and many others): jonathan@inner-sanctum:~/csi/ml$ ls /usr/lib/ocaml/3.08.3/netstring/|grep netstring netstring.a netstring.cma netstring.cmxa netstring_mt.cmi netstring_mt.cmo netstring_mt.cmx netstring_mt.mli netstring_mt.o netstring_pcre.cmi netstring_pcre.mli netstring_str.cmi netstring_str.mli netstring_top.cmi netstring_top.cmo netstring_top.mli jonathan@inner-sanctum:~/csi/ml$ What should I be doing next to get it to work? -- ++ Jonathan Hayward, jonathan.hayward@pobox.com ** To see an award-winning website with stories, essays, artwork, ** games, and a four-dimensional maze, why not visit my home page? ** All of this is waiting for you at http://JonathansCorner.com ** If you'd like a Google Mail (gmail.com) account, please tell me! ------=_Part_6440_24151275.1152650120425 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline

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.

Sounds like a good idea; I'm waiting for my registration to be processed. In the meantime, I'd really like to have this working soon, and am having more trouble than I've had getting a first basic program working (in Python, Perl, Java, etc.), and be on to asking real questions instead of "How do I get this to run?"

At the moment I get:

jonathan@inner-sanctum:~/csi/ml$ !.
./demo.ml
Error while loading "/usr/lib/ocaml/3.08.3/netstring/netstring.cma": interface mismatch on Filename
Error while loading "/usr/lib/ocaml/3.08.3/netstring/netstring.cma": interface mismatch on Filename.
Preprocessor error

The segment of the script that I think is responsible for this is:

#directory "/usr/lib/ocaml/3.08.3/pcre";;
#load "pcre.cma";;
#directory "/usr/lib/ocaml/3.08.3";;
#load "unix.cma";;
#directory "/usr/lib/ocaml/3.08.3/netstring";;
#load "netstring.cma";;
#directory "/usr/lib/ocaml/3.08.3/cgi/";;
#load "netcgi.cma";;

The directory it's looking for netstring contains the following files (and many others):

jonathan@inner-sanctum:~/csi/ml$ ls /usr/lib/ocaml/3.08.3/netstring/|grep netstring
netstring.a
netstring.cma
netstring.cmxa
netstring_mt.cmi
netstring_mt.cmo
netstring_mt.cmx
netstring_mt.mli
netstring_mt.o
netstring_pcre.cmi
netstring_pcre.mli
netstring_str.cmi
netstring_str.mli
netstring_top.cmi
netstring_top.cmo
netstring_top.mli
jonathan@inner-sanctum:~/csi/ml$

What should I be doing next to get it to work?

--
++ Jonathan Hayward, jonathan.hayward@pobox.com
** To see an award-winning website with stories, essays, artwork,
** games, and a four-dimensional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com

** If you'd like a Google Mail ( gmail.com) account, please tell me! ------=_Part_6440_24151275.1152650120425-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id B4CAEBB84 for ; Wed, 12 Jul 2006 13:21:00 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k6CBL0M4006352 for ; Wed, 12 Jul 2006 13:21:00 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA30705 for ; Wed, 12 Jul 2006 13:20:59 +0200 (MET DST) Received: from nz-out-0102.google.com (nz-out-0102.google.com [64.233.162.201]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6CBKwEF019954 for ; Wed, 12 Jul 2006 13:20:59 +0200 Received: by nz-out-0102.google.com with SMTP id z6so94235nzd for ; Wed, 12 Jul 2006 04:20:58 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=VouKtSWWeZHPhT7CqtWB638aQyd+RwcAhR7Dwyd6VqJV/ryhrX/FT79aiSo50L5Ot1mxxFm/Qx3Hcoi9nNYtQHrxrkClzSAMZ/LsAZX0gZfc00BmXNTtPLMrgAbHEDKcOuHESjik6QY8C4PncdywxfyFMM2aAKTsFch17iKrf5E= Received: by 10.36.10.20 with SMTP id 20mr726196nzj; Wed, 12 Jul 2006 04:20:58 -0700 (PDT) Received: by 10.36.101.10 with HTTP; Wed, 12 Jul 2006 04:20:58 -0700 (PDT) Message-ID: Date: Wed, 12 Jul 2006 23:20:58 +1200 From: "Jonathan Roewen" To: "Jonathan Hayward http://JonathansCorner.com" Subject: Re: [Caml-list] "Hello web" please Cc: caml-list@inria.fr In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20060711.164249.72518146.Christophe.Troestler@umh.ac.be> <20060711.201429.245541912.Christophe.Troestler@umh.ac.be> X-j-chkmail-Score: MSGID : 44B4DB1A.001 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at concorde with ID 44B4DB1C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44B4DB1A.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; findlib:01 site-lib:01 pcre:01 topfind:01 pcre:01 cmi:01 cmi:01 mli:01 dependencies:01 caml-list:01 cma:01 simpler:02 indicates:04 install:05 path:07 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 Make your life simpler, and install findlib ;-) (The presence of site-lib for the path to pcre indicates it'll work out of the box) 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.