in reply to viewer eyeball counter?
You could do this with a bit of Javascript on the webpage you display (generated from Perl CGI script), with the OnLoad and OnExit handlers.
The basic idea is to let the client side track the time instead of doing it from the server side.
When the user first load the page, the OnLoad handler is called, which sets a start timestamp. When the user clicks on another URL, the OnExit handler is called, which can submit a request back to your CGI script on the webserver with the time difference as a parameter.
This method will certainly not work if the user's browser has Javascript disabled. But I think most people have Javascript enabled in their browser, so it should work most of the time.