Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] OcamlMakefile not working for me...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Michael Leary <leary@n...>
Subject: Re: [Caml-list] OcamlMakefile not working for me...
On Mon, Aug 27, 2001 at 02:01:48PM +0200, Alain Frisch wrote:
> This function expects the program to be called with the CGI interface;
> when you call it directly on the command line, the Cgi module can't tell
> what the CGI arguments are and which _HTTP_ method you use.
> (Perl's CGI has something interesting for debugging: when the program is
> called on the command line, the module asks the user for 'name=value'
> bindings on the standard input; maybe this could be an useful feature
> for Cgi)

Here's what I ended up with.  Works from the command line even, and
functions more or less like "errors to browser" in Perl.  In practice, I'd
probably do some matching on 'value', and Do The Right Thing, i.e. maybe
request user input ala, but this at least works.  :)

open Printf;;
open Cgi;;

let value =
		parse_arguments default_config;
		Not_found -> "key not found";
		| Failure x -> "Failure: " ^ x;;
header "text/html";;

printf "<html><body>foo: %s</body></html>" value;;

Bug reports:  FAQ:
To unsubscribe, mail  Archives: