Skip to main content.
home | support | download

Back to List Archive

questions about swish-e

From: Kei <97909585d(at)not-real.polyu.edu.hk>
Date: Mon Feb 21 2000 - 17:29:43 GMT
Hi everybody.

In swishspider,  there is part of program in here

my $localpath = shift;
my $url = shift;
my $request = new HTTP::Request( "GET", $url );
my $response = $ua->simple_request( $request );

## Write out important meta-data.  This includes the HTTP code.
Depending on the
# code, we write out other data.  Redirects have the location printed,
everything
# else gets the content-type.

open( RESP, ">$localpath.response" ) || die( "Could not open response
file $localpath.response" );
print RESP $response->code() . "\n";
if( $response->code() == RC_OK ) {
    print RESP $response->header( "content-type" ) . "\n";
} elsif( $response->is_redirect() ) {
    print RESP $response->header( "location" ) . "\n";
}
close( RESP );

What is $localpath.response?  What is the function and content of
$localpath.response? Where will it go after close( RESP ); What about
$localpath.content and $localpath.link? Where will it go after close(
RESP );?

What is the function of print RESP $response->header( "content-type" ) .
"\n";
Copy the value of "content-type" in RESP such as text/html or just
"content-type"?
If I want to extra add charset = big5 in the RESP such as print RESP
$response->header( charset=big5" ) . "\n";
Is it right?

After adding the charset = big5, how could we change the program is
shown as below.

Is it from this program

if( $response->header("content-type") eq "text/html" ) {
 open( LINKS, ">$localpath.links" ) || die( "Could not open links file
$localpath.links\n" );
 $p = HTML::LinkExtor->new( \&linkcb, $url );
 $p->parse( $contents );
 close( LINKS );

to

if( $response->header("content-type") eq "text/html" ) {
     if ( $response->header("charset") eq "big5" ){ do something} else
 open( LINKS, ">$localpath.links" ) || die( "Could not open links file
$localpath.links\n" );
 $p = HTML::LinkExtor->new( \&linkcb, $url );
 $p->parse( $contents );
 close( LINKS );

Also, if I want to make two index files - one is english and one is
big5. Can i do that? Where could we change? In perl part or a C language
part?

I will very much appreciate your prompt response to the above questions.
Received on Mon Feb 21 12:34:22 2000