Apache-CustomKeywords

 view release on metacpan or  search on metacpan

lib/Apache/CustomKeywords.pm  view on Meta::CPAN

use Apache::ModuleConfig;
use Apache::Util;
use vars qw($MSN_URL $MSN_KEY @ISA);
@ISA = qw(DynaLoader);

$MSN_URL = 'http://auto.search.msn.com/response.asp';
$MSN_KEY = 'MT';

__PACKAGE__->bootstrap($VERSION) if $ENV{MOD_PERL};

sub handler($$) {
    my($class, $r) = @_;
    if ($r->proxyreq) {
	my $uri = $r->uri;
	if ($uri =~ /^$MSN_URL/) {
	    my $location = $class->convert_query($r);
	    if (defined $location) {
		$r->header_out(Location => $location);
		return REDIRECT;
	    }
	}

lib/Apache/CustomKeywords.pm  view on Meta::CPAN

    $query =~ s/ /+/g;
    return Apache::Util::escape_uri($query);
}

sub query {
    my($class, $r) = @_;
    my %args = $r->args;
    return $args{$MSN_KEY};
}

sub CustomKeyword($$$$) {
    my($cfg, $parms, $arg1, $arg2) = @_;
    $cfg->{CustomKeywordsDefault} ||= $arg1;
    $cfg->{CustomKeywords} ||= {};
    $cfg->{CustomKeywords}->{$arg1} = $arg2;
}

1;
__END__

=head1 NAME



( run in 0.594 second using v1.01-cache-2.11-cpan-65fba6d93b7 )