软讯网络 > 编程语言 > 其他编程语言 > xchat脚本之google search
【标 题】:xchat脚本之google search
【关键字】:
xchat,google,search
【来 源】:http://www.cublog.cn/u/8057/showart.php?id=151241
xchat脚本之google search
use strict;
push @INC,$ENV{HOME}.'/mydoc/prog/MYPM';
require Google;
IRC::register ("hw google tools v0.01 by Daniel Miao", "0.01", "", "");
IRC::print ("hw google tools loaded");
IRC::add_command_handler("hwgoogle", "hwgoogle");
sub hwgoogle {
my $text = shift;
my ($cmd, $stext) = ( $text =~ m:(\w*)\s*(.*): );
return hwgoogle_search($stext) if $cmd eq 'search';
IRC::print("no such command: $text");
return 1;
}
sub hwgoogle_search {
my $stext = shift;
IRC::command("/me search \"$stext\" and found: ".join(' ',Google::search($stext)));
return 1;
}
其中有个我自己的模块。