If your page actually _is_ a script, it runs upon opening, i.e. CGI or mod_perl, depending on your Apache setup. You can set it up to run a background job which does whatever, including reading from the Apache environment variables the information you want from the user's system. Once it's launched the background job, you have it print the next HTML page, which has a meta-refresh embedded in it. In the mean time, your background job completes creating its page, and the refresh sends your user to it. That's the long way, to be used only if you have lots of stuff to do. In reality, Perl can do the simple stuff you ask of it so that the dynamic stuff happens between the click and the new page appearing. It's only if you need the pages to stay visible long enough for human eyeballs to read and minds to process that you need to resort to refreshes et al.

Short way: or long way:
A caveat is that the referrer and user variables that Apache maintains are often only those of proxies, so you will often get the ip's of AOL proxy machines as opposed to the end-user ip.

Some links:

http://httpd.apache.org/docs/env.html
http://www.apachefreaks.com/apache2/env.html
http://cgi.resourceindex.com/Documentation/Environment_Variables/

In reply to Re: Running Perl thru HTML by samizdat
in thread Running Perl thru HTML by GhostWheel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.