All pastes #257833 Raw Edit

Untitled

public text v1 · immutable
#257833 ·published 2006-11-25 20:44 UTC
rendered paste body
sub readsock {
	my $sock = shift;
	read($sock,$rawdata,222) or die("Failed reading socket");
	@data = split(" ",$rawdata) or die("Failed to separate data for processing");
	return @data;
}
sub getfile {
	my $sock = shift;
	open(reqfile, $sock);
	@reqfile = <reqfile>;
	return @reqfile;
}
sub nofile {
	my $sock = shift;
	@dirlist = glob("*");
	print $sock "<HTML><head><title>Perl HTTP Server :: ";
	print $sock @conf[0];
	print $sock "</title></head><body bgcolor=#000000 text=#ffffff vlink=#ffff00 alink=#ffff00 link=#ffffff><center><h2>No index file, listing dir...</h2></center><br><hr><br>";
	foreach $dirs (@dirlist) { 
		print $sock "<a href='".$dirs."/'>". $dirs ."</a><br>";
	}
	print $sock "<br><hr><br>Perl HTTP Serv. V1a</body></HTML>\r\n";
}
1;