Hi All,

I really someone understands what I 'm trying to do
with the codes below.Pls help me to troubleshoot the
codes below.

I 'm sure I look dumb in this but pls. feel free to
give ur comments and suggestion.

Rgds,


#!/usr/bin/perl -w

require WWW::Search;
use CGI;


     $q = new CGI;
     $word = $q->param('query');
     chomp($word);
     my $search = new WWW::Search ('AltaVista');
     $search->maximum_to_retrieve(10);
     $search->native_query
(WWW::Search::escape_query($word));

&do_print;



#Subroutine to print search results
sub do_print {

   print $q->header;
   print $q->start_html("Web Search");
   print $q->h1({-align=>"center"},'Web Concordance
Search Results');
   print $q->h3({-align=>"center"},"for search term
'$word'");
   print $q->h4({-align=>"center"},"Producing
output....\n");
   print $q->hr;


   while ( $results = $search->next_result()) {
    $n++;


         print $q->a({href=>$results->url},
$results->url);
         $urlresult = $result->url;
         $result->description = @desc;
              $desc = "@desc";
              $desc = ~s(<[^>*>)()g;
              @splittext = split(/$word/,$desc);

           #To extract concordance lines from text
               for (my $i=1; $i < @splittext; $i++)
                 {
                   my $before = substr(('
'x10).$splittext[$i-1],-20,20);
                   my $after = substr($splittext[$i].'
'x10,0,20);
                   print p($before, strong($word),
$after,"\n"),
                  }
         print $q->br;
         print $results->title,"\n";
         print $q->br;
         print $results->description,"\n";
         print $results->change_date,"\n";
         print $q->hr;
          if ($n == 0) {
            print "<P>Results not found";}
          }
         print qq{<P><A
HREF="http://mogana/index.htm";>Search Again!</A>};
         print $q->end_html;

1;
}





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to