From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id AAA30135; Tue, 28 Aug 2001 00:10:54 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA30813 for ; Tue, 28 Aug 2001 00:10:53 +0200 (MET DST) Received: from smtp.nwlink.com (smtp.nwlink.com [209.20.130.57]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f7RMAqP12042 for ; Tue, 28 Aug 2001 00:10:52 +0200 (MET DST) Received: from ip178.usw22.rb1.bel.nwlink.com (ip178.usw22.rb1.bel.nwlink.com [207.202.195.178]) by smtp.nwlink.com (8.9.3/8.9.1) with SMTP id PAA18489 for ; Mon, 27 Aug 2001 15:09:06 -0700 (PDT) Received: (qmail 12030 invoked by uid 500); 27 Aug 2001 22:10:43 -0000 Date: Mon, 27 Aug 2001 15:10:43 -0700 From: Michael Leary To: Alain Frisch Cc: caml Subject: Re: [Caml-list] OcamlMakefile not working for me... Message-ID: <20010827151043.C11197@jean.nwlink.com> References: <20010827025906.A9673@jean.nwlink.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from frisch@clipper.ens.fr on Mon, Aug 27, 2001 at 02:01:48PM +0200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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 "foo: %s" 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