Okay yes, this is very ugly. I had it kind of nice and then
I decided to go all out and compact it a lot. So here is a
fully-functional CGI script that allows anyone to come in,
enter any name they want (yes, even multiple instances of
the same nick are allowed) and chat together. It does use
two small pieces of javascript: one to refresh the chat
messages (because inserting that meta tag in the HTML
headers would have taken more space) and one that sets focus
to the chat box when you put your mouse over it.
It doesn't really fit in the category of obfu, but it will
look better here than anywhere else. Code is for reusable
stuff, same with Snippets. I don't think anyone'll want to
use this!
Features of the program? Only one: URL's are turned into
links ONLY when used in the perlmonks way (using square
brackets). And even then, it must be a URL between the
brackets and nothing else. No vertical bar to name the
link!
So here it is. All in 19 lines:
#!c:/perl/bin/perl
use strict;use CGI':Vars';use Data::Dumper;use Fcntl':flock';
use IO::Scalar;my%i=CGI::Vars;my($a,$b,$d,$f,$r,$s,$g)=($ENV{
'SCRIPT_NAME'},$i{a},$i{u},$i{m});open L,">2.2"or die;flock L
,LOCK_EX or die;our%c;do"1.1";$.=new IO::Scalar \$s;select$.;unless(
$b){print qq{};}if($b eq"e"){print qq{};my$e;while(++$e){last if!
$c{$e};print qq{$c{$e}[0]: $c{$e}[1]
}if$c{$e};}}
if($b eq"c"){if(!$d){print qq{};++$g;}if($f){$f=~s/\</g;$f=~s/\[(.*?)\]/$1<\/a>/g;$c{++$c{n}}=[$d,$f];delete$c{$c{n}-15};}if(!$g){
print qq{};}}open A,">1.1"
or die;flock A,LOCK_EX or die;print A Data::Dumper->Dump([\%c], ['*c']);
print$b?"