1 (** Wrapper around Perl [Net::Google::Search] class.
3 * Copyright (C) 2003 Merjis Ltd.
5 * $Id: pl_Net_Google_Search.ml,v 1.3 2003-10-16 13:41:07 rich Exp $
10 open Pl_Net_Google_Response
12 let _ = eval "use Net::Google::Search"
14 class net_google_search sv =
19 string_of_sv (call_method sv "key" [])
21 call_method_void sv "key" [sv_of_string v]
23 string_of_sv (call_method sv "query" [])
25 call_method_void sv "query" [sv_of_string v]
27 int_of_sv (call_method sv "starts_at" [])
28 method set_starts_at v =
29 call_method_void sv "starts_at" [sv_of_int v]
31 int_of_sv (call_method sv "max_results" [])
32 method set_max_results v =
33 call_method_void sv "max_results" [sv_of_int v]
34 method restrict types =
35 string_of_sv (call_method sv "restrict" (List.map sv_of_string types))
37 bool_of_sv (call_method sv "filter" [])
39 call_method_void sv "filter" [sv_of_bool v]
41 bool_of_sv (call_method sv "safe" [])
43 call_method_void sv "safe" [sv_of_bool v]
45 string_of_sv (call_method sv "lr" (List.map sv_of_string langs))
47 string_of_sv (call_method sv "ie" (List.map sv_of_string encs))
49 string_of_sv (call_method sv "oe" (List.map sv_of_string encs))
50 method return_estimatedTotal =
51 bool_of_sv (call_method sv "return_estimatedTotal" [])
52 method set_return_estimatedTotal v =
53 call_method_void sv "return_estimatedTotal" [sv_of_bool v]
55 let sv = call_method sv "response" [] in
56 let av = deref_array sv in
57 av_map (fun sv -> new net_google_response sv) av
59 let sv = call_method sv "results" [] in
60 let av = deref_array sv in
61 av_map (fun sv -> new net_google_response sv) av