X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=wrappers%2Fpl_WWW_Mechanize.ml;h=f9e46044f992ec5789f744d5c1c7a572b49d8053;hb=55318cc354e514953bca429618150bb069e9920d;hp=d5a23760bbbb6bc49e4f0a9d81a4375b8291d1da;hpb=caee309c74f84ec2f76f64e1f416536f58fd720f;p=perl4caml.git diff --git a/wrappers/pl_WWW_Mechanize.ml b/wrappers/pl_WWW_Mechanize.ml index d5a2376..f9e4604 100644 --- a/wrappers/pl_WWW_Mechanize.ml +++ b/wrappers/pl_WWW_Mechanize.ml @@ -2,7 +2,7 @@ * * Copyright (C) 2004 Merjis Ltd. * - * $Id: pl_WWW_Mechanize.ml,v 1.5 2005-05-19 11:10:18 rich Exp $ + * $Id: pl_WWW_Mechanize.ml,v 1.6 2005-08-16 15:39:22 rich Exp $ *) open Perl @@ -129,7 +129,33 @@ object (self) method submit () = call_method_void sv "submit" [] - (*method submit_form ?form_number ?form_name ?fields ?button ?xy () *) + method submit_form ?form_number ?form_name ?fields ?button ?xy () = + let args = ref [] in + let add name f = function + | None -> () + | Some p -> args := sv_of_string name :: f p :: !args + in + add "form_number" sv_of_int form_number; + add "form_name" sv_of_string form_name; + (match fields with + | None -> () + | Some fields -> + let hv = hv_empty () in + List.iter ( + fun (name, value) -> + hv_set hv name (sv_of_string value) + ) fields; + let sv = hashref hv in + args := sv_of_string "fields" :: sv :: !args + ); + add "button" sv_of_string button; + (match xy with + | None -> () + | Some (x, y) -> + args := sv_of_string "x" :: sv_of_int x :: + sv_of_string "y" :: sv_of_int y :: !args); + let sv = call_method sv "submit_form" !args in + new Pl_HTTP_Response.http_response sv method success = let sv = call_method sv "success" [] in