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--