Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

framechat google tag patch

by epoptai (Curate)
on May 08, 2001 at 22:49 UTC ( [id://78928]=note: print w/replies, xml ) Need Help??


in reply to framechat private messaging update

Updated to deal with multiple keywords.

This patch enables the new google tags. The codebase has been updated with this.

Add four lines to sub makelinks (adjacent the cpan lines):

$content=~s/\[google:\/\/([^|\]]+)\|([^\]]+)\]/&google('G',$1,$2)/eig; + # [google://keyword(s)|text] $content=~s/\[google:\/\/([^|\]]+)\]/&google('G',$1)/eig; + # [google://keyword(s)] $content=~s/\[lucky:\/\/([^|\]]+)\|([^\]]+)\]/&google('L',$1,$2)/eig; + # [lucky://keyword(s)|text] $content=~s/\[lucky:\/\/([^|\]]+)\]/&google('L',$1)/eig; + # [lucky://keyword(s)]
Add this subroutine after sub makelinks:
sub google { # [google://] and [lucky://] my$google = 'http://www.google.com/search?q='; my$luck = '&btnI=lucky'; my($fu,$g,$n) = shift; if($fu eq 'G'){ undef($luck) } $n = CGI::escape($_[0]); if(@_ == 2){ $g = qq~<a href="$google$n$luck"$trgt>$_[1]<\/a>~; } if(@_ == 1){ $g = qq~<a href="$google$n$luck"$trgt>$_[0]<\/a>~; } return $g; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://78928]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2024-04-23 10:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found