in reply to site statistics
Warning: I have little to say of a practical nature here. I'll just try to explain why what you think you want to do is probably not the way you should try to do it.
The URL of the referring page is not specifically a creature of the CGI protocol (it's defined by the HTTP protocol) the referrer is passed *to* the webserver by the client (the browser)1, so an uncooperative client needn't provide that information. The environment variable REFERER, which is available to CGI programs, is where to look. In Perl, that's in the %ENV hash, i.e. $ENV{REFERER} holds the value of this variable.
The REFERER (yeah, that's how it's misspelled =) history isn't quite the same as the browser's history, either. Basically, the idea is that you have to follow a link, submit a form, or be redirected from a page to the current page for it to be the REFERER of the current page (so, e.g. if you type in a new URL, the page you were on when you typed that URL in will *not* be the referer of the new page; but it will be the previous one in your browser's history list, and it will be the one your browser attempts to display if you hit the "back" button). Otherwise, the value of REFERER is generally available to the server and (e.g.) can be included in the webserver's logs. You'll have to check with the admin of your webserver if you want that kind of information. There are log analysis tools that attempt to track the length of a client's "sessions" but they rely on a range of strategies, not just the referrers.
I don't believe that even with browsers that implement Javascript, the history is *by default* available to you. And if it is (and it may well be, it's been a while since I checked this sort of thing), that's criminally bad design.
Given all those caveats, if you *must* track user's progress ... and I'll assume you don't have nefarious purposes in mind -- is to do it from the server side. Set a cookie with a unique ID, and on each new request, add the URL of the request to the (ordered) list of things as the request is made. This will of course require that you have the ability to read the cookie on every request and modify your logs. This wouldn't be too hard to do in mod_perl, which allows you to define handlers for each phase of the Apache request cycle. That's pretty involved though.
1 From RFC 2068, which lays out the HTTP 1.1 Protocol :a browser client could have a toggle switch for browsing openly/anonymously, which would respectively enable/disable the sending of Referer and From information.
HTH.
perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'
|
|---|