CGI IRC Server
CGI
Download (.zip)
#!perl -w
use IO::Socket::INET; use IO::Socket; use IO::Select; use strict; use warnings; use diagnostics;
print "Server started at ".scalar(localtime)."\n"; my $lsn = new IO::Socket::INET(Listen => 1, LocalPort => 6667); my $sel = new IO::Select($lsn); my $welcome = <<'EOT'; - Welcome to our IRC server - --------------------------------------------------------- This si a free software and you can use and redistrubute, modify, write and sux of us. --------------------------------------------------------- Vulcho Nedelchev
EOT
while(my @ready = $sel->can_read) { foreach my $fh (@ready) { if($fh == $lsn) { # Create a new socket my $new = $lsn->accept; $sel->add($new); $new->write($welcome); print $new->getline; print $new->getline; $new->write("Good bye nigga \n"); }else{ $sel->remove($fh); $fh->close; } } }
|