#!/usr/bin/perl use strict; use IO::Socket; use LWP::UserAgent; use Irssi; use Irssi::Irc; use vars qw($VERSION %IRSSI); use Irssi qw(command_bind active_win); $VERSION = '1.0'; %IRSSI = ( authors => 'sir', contact => 'mjg@0x90.org', name => 'letme', description => 'create a tinyurl of letmegooglethatforyou.com', license => 'GPL', ); command_bind( letme => sub { my ($msg, $server, $witem) = @_; my @foo = split(/ /, $msg); my $newmsg = "http://letmegooglethatforyou.com/?q=".join('+',@foo); my $answer = tinyurl($newmsg); my $window = Irssi::active_win(); $window->command("/SAY $answer"); } ); sub tinyurl ($) { my $url = shift or die 'No URL passed'; my $tinyurl = 'http://tinyurl.com/api-create.php?url='.$url; my $browser = LWP::UserAgent->new; my $resp = $browser->get($tinyurl); my $content = $resp->content; return $resp->content }