I am using this script for a piped log setup in Apache 2:
#!/usr/local/bin/perl
$|=1; # Use unbuffered output
while (<STDIN>)
{
if (<STDIN> =~ m/(.php|.html|.htm|.dhtml|.cpp|.h|.c|.txt|.pdf|.pl)$/)
{system("beep");}
}
I am sending in the directive %f to give it the filename. As you can tell, it checks to see if the requested filename is a content file. If so, it tells the system to beep. For some reason however, the server only beeps every two times a content page is accessed. Does anyone know why this might happen?
I'm pretty sure it has to do with the way I'm using <STDIN>
, because this is my first Perl script.