#!/usr/bin/perl

 

$logfile = "access.log"; #アクセスログ用ファイル

$countfile = "count.log"; #ログ用ファイル

 

 

print "Content-type: text/html¥n¥n";

print "<html>¥n<head>¥n";

print "<title>access log </title>¥n";

print "</head>¥n<body>¥n";

print "<h2>Access log </h2>¥n";

print "<hr>¥n";

print "<pre>¥n";

 

open(CFILE, "+<$countfile");

flock(CFILE,2);

 

@log = <CFILE>;

chop @log;

print "$log[1]¥n";

print "Count = $log[0]¥n";

 

flock(CFILE,8);

close(CFILE);

 

&maketable($logfile);

 

 

print "</pre>¥n";

print "<hr>¥n";

print "</BODY>¥n";

print "</HTML>¥n";

 

exit;

 

 

sub maketable{

local($logfile) = @_;

open(FILE,"$logfile");

flock(FILE,1);

chop(@logs = <FILE>);

 

 

print "¥n";

 

foreach $line (@logs){

print $line;

print "¥n";

 

}

flock(FILE,8);

close(FILE);

}