1 (** Wrapper around Perl [HTTP::Cookies] class.
3 * Copyright (C) 2003 Merjis Ltd.
5 * $Id: pl_HTTP_Cookies.ml,v 1.1 2004-11-22 17:08:36 rich Exp $
10 let _ = eval "use HTTP::Cookies"
12 class http_cookies sv =
17 method save ?filename () =
18 let args = match filename with
20 | Some filename -> [sv_of_string filename] in
21 call_method_void sv "save" args
23 method load ?filename () =
24 let args = match filename with
26 | Some filename -> [sv_of_string filename] in
27 call_method_void sv "load" args
30 call_method_void sv "revert" []
32 method as_string ?skip_discardables () =
33 let args = match skip_discardables with
35 | Some b -> [sv_of_bool b] in
36 string_of_sv (call_method sv "as_string" args)
40 let new_ ?file ?autosave ?ignore_discard ?hide_cookie2 () =
42 let may f = function None -> () | Some v -> f v in
44 args := sv_of_string "file" :: sv_of_string v :: !args) file;
46 args := sv_of_string "autosave" :: sv_of_bool v :: !args) autosave;
48 args := sv_of_string "ignore_discard" :: sv_of_bool v :: !args)
51 args := sv_of_string "hide_cookie2" :: sv_of_bool v :: !args)
53 let sv = call_class_method "HTTP::Cookies" "new" !args in