*
* Copyright (C) 2003 Merjis Ltd.
*
- * $Id: pl_HTML_Form.ml,v 1.1 2004-11-26 13:33:10 rich Exp $
+ * $Id: pl_HTML_Form.ml,v 1.3 2005-01-14 19:04:48 rich Exp $
*)
open Perl
object (self)
method sv = sv
- (* No methods wrapped yet! *)
+ method attr name =
+ let sv = call_method sv "attr" [sv_of_string name] in
+ (* sv_is_undef doesn't work properly XXX *)
+ if sv_is_undef sv then None else Some (string_of_sv sv)
+ method set_attr name value =
+ call_method_void sv "attr" [sv_of_string name; sv_of_string value]
+
+ (* The following isn't a real method. The return type of HTML::Form->inputs
+ * isn't documented, but I wanted a list of input names (as strings) anyway.
+ *)
+ method input_names =
+ let inputs = call_method_array sv "inputs" [] in
+ let names = List.map (fun sv -> call_method sv "name" []) inputs in
+ List.map string_of_sv names
end