dculpSC has asked for the wisdom of the Perl Monks concerning the following question:

Help - I have a network(SNMP) web page that displays a table of our trunk switches and their associated octets/errors. I need to have the page update the info every "n" seconds without using "client-side techs", i.e. java and without using external files. Any suggestions on taking the snmp data and POSTING it to a new page without client-involvement (submit)? Thanks, David

Replies are listed 'Best First'.
(jeffa) Re: Dynamic Page - AutoPOST
by jeffa (Bishop) on Jun 01, 2001 at 22:06 UTC
    If you are wanting to do what i think you are wanting to do, just use a meta tag:
    use CGI; # have to send the values via GET for refresh my $script = $CGI->script_name . '?foo=bar&baz=spaz'; my $CGI = new CGI; print $CGI->header(), qq|<head><title>refresh every 8 seconds</title>|, qq|<META HTTP-EQUIV="refresh" content="8;URL=$script"></head>|; # rest of the web page here
    Jeff

    R-R-R--R-R-R--R-R-R--R-R-R--R-R-R--
    L-L--L-L--L-L--L-L--L-L--L-L--L-L--
    
      Thanks for the quick reply. I'm not sure if this will work. Each time the page is entered, a collection of new values is done. Then other values are calculated based on the "previous page's data". How will the values be passed ? The data is too large to use the standard "query string". David
        Hmmm, if the data is indeed to large to slam into a query string, then you should look into saving the state of the form to a file. Take a look at the save() method in the docs for CGI.pm.

        The gist is to try to open the file and use it to create a new CGI object. After you set the new values, save the state to the file. This will not work if you plan on having different data available to different users, but if everybody is viewing the same results, it shouldn't be a problem.

        Don't forget to use flock on the state file.

        Jeff

        R-R-R--R-R-R--R-R-R--R-R-R--R-R-R--
        L-L--L-L--L-L--L-L--L-L--L-L--L-L--
        
        Then just pass an identifier, and use it to key into a server side lightweight database, like File::Cache. I show this in my latest columns in Linux Magazine, on creating an on-line quiz. The text of the columns won't be online for a couple more months though, because of the 3-month delay restriction.

        -- Randal L. Schwartz, Perl hacker

Re: Dynamic Page - AutoPOST
by novitiate (Scribe) on Jun 01, 2001 at 23:48 UTC
    take a look at this awesome system put together by our very
    own Saint Erudil :

    Dynamic server push by Erudil

    humbly,
    novitiate

    "...goodnight you princes of main(e)"  --The Cider House Rules

    UPDATE: Dont' know if the code is avail. - drop him a line and see if he has more info.
      Saint Erudil, Very Nice ! I've printed the info and will review it shortly. I came across some articles a few days that were using CGI/Server Push Mark Ohrenschall, Julia Collins @ noaa.gov. At that time, I thought that there must be a simpler way to accomplish what I needed. However, it is becoming more evident that I will need to use these concepts. Thanks for the input ! David (dculp@sc.rr.com)