Download pdf - Free Books
Download pdf - Free Books
Download pdf - Free Books
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
start_form(-method=>'GET'),'Query: ', textfield(-name=>'query'),' ',submit(-name=>'submit', -value=>'Search'), br( ),'Enter up to 4 querykeywords or "quoted phrases"',end_form( ), p( );if (param('query')) {# Glean keywordsmy @keywords = grep !/^\s*$/, split /([+-]?".+?")|\s+/,param('query');scalar @keywords > 4 andprint('Only 4 query keywords or phrasesallowed.'), last;my $google_search = SOAP::Lite->service("file:$google_wdsl");printstart_table({-cellpadding=>'10', -border=>'1'}),Tr([th({-colspan=>'2'}, ['Result Counts byPermutation' ])]),Tr([th({-align=>'left'}, ['Query', 'Count'])]);my $results = {}; # keep track of what we've seen acrossqueries# Iterate over every possible permutationmy $p = new Algorithm::Permute( \@keywords );while (my $query = join(' ', $p->next)) {# Query Googlemy $r = $google_search ->doGoogleSearch($google_key,$query,0, 10, "false", "", "false", "", "latin1", "latin1");print Tr([td({-align=>'left'}, [$query, $r->{'estimatedTotalResultsCount'}] )]);@{$r->{'resultElements'}} or next;# Assign a rankmy $rank = 10;foreach (@{$r->{'resultElements'}}) {$results->{$_->{URL}} = {title => $_->{title},snippet => $_->{snippet},seen => ($results->{$_->{URL}}->{seen}) + $rank};