1 (** Wrapper around Perl [URI] class. *)
2 (* Copyright (C) 2003 Merjis Ltd.
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this library; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.
19 $Id: pl_URI.ml,v 1.6 2008-03-01 13:02:21 rich Exp $
24 let _ = eval "use URI"
33 string_of_sv (call_method sv "scheme" [])
34 method set_scheme scheme =
35 call_method_void sv "scheme" [sv_of_string scheme]
37 string_of_sv (call_method sv "opaque" [])
38 method set_opaque opaque =
39 call_method_void sv "opaque" [sv_of_string opaque]
41 string_of_sv (call_method sv "path" [])
42 method set_path path =
43 call_method_void sv "path" [sv_of_string path]
45 string_of_sv (call_method sv "fragment" [])
46 method set_fragment fragment =
47 call_method_void sv "fragment" [sv_of_string fragment]
48 method set_no_fragment () =
49 call_method_void sv "fragment" [sv_undef ()]
51 string_of_sv (call_method sv "as_string" [])
53 string_of_sv (call_method sv "canonical" [])
55 string_of_sv (call_method sv "abs" [sv_of_string base])
57 string_of_sv (call_method sv "rel" [sv_of_string base])
61 string_of_sv (call_method sv "host" [])
62 method set_host host =
63 call_method_void sv "host" [sv_of_string host]
65 string_of_sv (call_method sv "port" [])
66 method set_port port =
67 call_method_void sv "port" [sv_of_string port]
69 string_of_sv (call_method sv "host_port" [])
70 method set_host_port host_port =
71 call_method_void sv "host_port" [sv_of_string host_port]
73 int_of_sv (call_method sv "default_port" [])
77 let new_ ?scheme str =
82 | Some scheme -> [sv_of_string scheme] in
83 let sv = call_class_method "URI" "new" args in
86 let new_abs str base =
87 let sv = call_class_method "URI" "new_abs" [sv_of_string str;