1 (* Example program which uses Net::Google to query Google.
2 * You will need to have a Google API key in ~/.googlekey for this to work.
3 * Copyright (C) 2003 Merjis Ltd.
4 * $Id: google.ml,v 1.4 2003-12-11 17:41:52 rich Exp $
12 (* Load Google API key. *)
13 let home = Sys.getenv "HOME" in
14 let chan = open_in (home ^ "/.googlekey") in
15 let key = input_line chan in
18 (* Create the Google query object. *)
19 let google = Pl_Net_Google.new_ ~key () in
22 let search = google#search () in
23 search#set_query "merjis";
24 search#set_max_results 5;
26 printf "Top 5 results for \"merjis\":\n"; flush stdout;
30 printf "* %s\n <URL:%s>\n\n" response#title response#url
33 (* Perform a full collection - good way to find GC/allocation bugs. *)