rendered paste bodysub 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;