spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / xml / column57

Google SVG Search III

Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source

Wrapping up our Google API project, we finally convert the Perl script into a CGI and decorate the SVG output with a bit of HTML.

Going CGI

Perl has traditionally been popular for powering dynamic Web sites, not least due to the mighty but easy to use CGI module. A common technique is to use the same script for all requests of our little application, distinguishing between them through parameters:

RequestParameter pParameter q
Start HTML page(none or empty)(none or empty)
Response HTML page(none or empty)[search term]
Response embedded SVGsvg[search term]

In code this looks like:

#!/usr/bin/perl -w
use strict;
use CGI;
...
my $cgi = new CGI;
my $query = $cgi->param('q');
my $part = $cgi->param('p');

if (!defined($query) || $query eq "") {
  # print start HTML page
}
else {
  if (!defined($part) || $part eq "") {
    # print result HTML page
  }
  else {
    # access Google and print SVG results
  }
}

The start page consists of a header with a simple form for entering the search term:

  print <<EOF;
content-type: text/html

<html><head><title>Google SVG Search</title></head>
<body><h1>Google SVG Search</h1>
<form><input type=text name=q><input type=submit value='Google Search'></form>
</body></html>
EOF

Google SVG Search


And here come the results...


Produced by Michael Claßen

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Administering RBAC in PHP 5 CMS Framework · xref: Automatic Cross Referencing Script · Book Review: Content Rich
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags

URL: http://www.webreference.com/xml/column57/index.html
Created: Jun 10, 2002
Revised: Jun 10, 2002