Handle NUL characters in Perl strings properly.
[perl4caml.git] / wrappers / pl_WWW_Mechanize.ml
index a0b5f60..a666ecd 100644 (file)
@@ -2,7 +2,7 @@
   *
   * Copyright (C) 2004 Merjis Ltd.
   *
-  * $Id: pl_WWW_Mechanize.ml,v 1.3 2005-01-13 16:06:04 rich Exp $
+  * $Id: pl_WWW_Mechanize.ml,v 1.4 2005-02-13 16:33:28 rich Exp $
   *)
 
 open Perl
@@ -156,7 +156,9 @@ object (self)
     let sv = call_method sv "content" [] in
     string_of_sv sv
   (* method current_forms = *)
-  (* method links = *)
+  method links =
+    let svs = call_method_array sv "links" [] in
+    List.map (new www_mechanize_link) svs
   method is_html =
     let sv = call_method sv "is_html" [] in
     bool_of_sv sv
@@ -185,6 +187,21 @@ object (self)
 
 end
 
+(* Not much documentation exists for the WWW::Mechanize::Link class.  As far
+ * as I can see, the only documented method is #url to return the URL. XXX
+ *)
+and www_mechanize_link sv =
+
+object (self)
+
+  method sv = sv
+
+  method url =
+    let sv = call_method sv "url" [] in
+    string_of_sv sv
+
+end
+
 (* XXX Should be able to pass args to constructor of LWP::UserAgent. *)
 (* XXX WWW::Mechanize has additional parameters. *)
 let new_ ?autocheck () =