1 (** Wrapper around Perl [URI] class.
3 * Copyright (C) 2003 Merjis Ltd.
5 * $Id: pl_URI.ml,v 1.5 2005-02-13 17:09:14 rich Exp $
10 let _ = eval "use URI"
19 string_of_sv (call_method sv "scheme" [])
20 method set_scheme scheme =
21 call_method_void sv "scheme" [sv_of_string scheme]
23 string_of_sv (call_method sv "opaque" [])
24 method set_opaque opaque =
25 call_method_void sv "opaque" [sv_of_string opaque]
27 string_of_sv (call_method sv "path" [])
28 method set_path path =
29 call_method_void sv "path" [sv_of_string path]
31 string_of_sv (call_method sv "fragment" [])
32 method set_fragment fragment =
33 call_method_void sv "fragment" [sv_of_string fragment]
34 method set_no_fragment () =
35 call_method_void sv "fragment" [sv_undef ()]
37 string_of_sv (call_method sv "as_string" [])
39 string_of_sv (call_method sv "canonical" [])
41 string_of_sv (call_method sv "abs" [sv_of_string base])
43 string_of_sv (call_method sv "rel" [sv_of_string base])
47 string_of_sv (call_method sv "host" [])
48 method set_host host =
49 call_method_void sv "host" [sv_of_string host]
51 string_of_sv (call_method sv "port" [])
52 method set_port port =
53 call_method_void sv "port" [sv_of_string port]
55 string_of_sv (call_method sv "host_port" [])
56 method set_host_port host_port =
57 call_method_void sv "host_port" [sv_of_string host_port]
59 int_of_sv (call_method sv "default_port" [])
63 let new_ ?scheme str =
68 | Some scheme -> [sv_of_string scheme] in
69 let sv = call_class_method "URI" "new" args in
72 let new_abs str base =
73 let sv = call_class_method "URI" "new_abs" [sv_of_string str;