#!/usr/bin/perl -w use Net::IRC; use strict; use warnings; use threads; my $irc = new Net::IRC; my $conn = $irc->newconn( Server => 'de.quakenet.org', Port => '6667', Nick => 'HelloBot007', Ircname => 'Bot007!', Username => 'hello' ); $conn->{channel} = '#testor55'; sub on_connect { my $conn = shift; $conn->join($conn->{channel}); $conn->privmsg($conn->{channel}, 'Hello everyone!'); $conn->{connected} = 1; } sub on_join { my ($conn, $event) = @_; my $nick = $event->{nick}; $conn->privmsg($conn->{channel}, "Hello, $nick!"); } sub on_part { my ($conn, $event) = @_; my $nick = $event->{nick}; $conn->privmsg($conn->{channel}, "Goodbye, $nick!"); } $conn->add_handler('join', \&on_join); $conn->add_handler('part', \&on_part); $conn->add_handler('376', \&on_connect); my $web_start = threads->create('start_web'); $web_start->join(); my $irc_start = threads->create('start_irc'); $irc_start->join(); sub start_web { while (1) {print "hallo\n"; sleep 10;}} sub start_irc { $irc->start(); }