#!/sw/bin/perl
print (»Content-Type: text/html\n\n«);
$filename = $ENV{'PATH_TRANSLATED'};
if (!open (IN,$filename)) { print (»<HEAD><TITLE>File not found</TITLE></HEAD><BODY>\n«); print (»<H1>File not found</H1>URL: «,$ENV{'PATH_INFO'}); print (»<HR><ADDRESS>«,$ENV{'SCRIPT_NAME'},»</ADDRESS></BODY>\n«); exit; }
while (<IN>) { if (/<COUNTER>/) { $cntfile = $filename . ».cnt«; if (open (CNT, »+<$cntfile«)) { $cnt = <CNT>; chop $cnt; $ocnt = $cnt; $cnt++; seek (CNT, 0, 0); print (CNT $cnt, »\n«); close (CNT); s/<COUNTER>/$ocnt/e; } else { s/<COUNTER>//; } } print $_; }
|