Version française
Home     About     Download     Resources     Contact us    
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 CGI.pm, but this at least works.  :)

open Printf;;
open Cgi;;

let value =
	try
		parse_arguments default_config;
		argument_value("foo")
	with
		Not_found -> "key not found";
		| Failure x -> "Failure: " ^ x;;
	
header "text/html";;

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



-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr