Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

pudge (1)

  (email not shown publicly)
AOL IM: Crimethnk (Add Buddy, Send Message)

I run this joint, see?

Journal of pudge (1)

Friday April 19, 2002
09:29 AM


[ #4327 ]

I took the demo Google API script and modified it to work to my needs. First, I made it pop up a dialog asking for search terms using MacPerl::Ask(). I reorganized it slightly, and added simple XML escaping (so I could search for "A&E"). Then I made a Template to output an HTML file, and used Mac::InternetConfig::GetURL() to open the file in my browser.

The result is this. A web page that looks how I want it to look. And since I can execute the script from any program with cmd-opt-shift-] (using OSAMenu), it is very convenient.

Sure, I could just have the script do GetURL("$searchterms"), but where is the fun in that? Plus, I could extend this to do a more elaborate dialog box, which would include a list of available search engines (using WWW::Search, perhaps), and a Google-like option to merely open the first returned site directly.

NOTE: MacPerl has a bug or two in it that prevents installing Template through normal means. Will be fixed in next release (necessary patches for MacPerl and for Template have been submitted).

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.