T'is me again. I'm still trying to grow into this extra large monk's robe, so please bear with me.

I have a small piece of code running under mod_perl and Apache::Registry (using a module is not an option at this point) and I've run into a very odd caching issue.

When I reload the same page over and over and over, printing out what $vars{action} should contain, I get very incorrect results.

My initial page is 'index.pl?action=home'. I'm exposing this variable with:

print p("\$vars{action} passed was: $vars{action}\n") if $vars{action} +;

When I reload that page successively, I get:

$vars{action} passed was: news $vars{action} passed was: home $vars{action} passed was: $vars{action} passed was: dl

..which matches any of the various vars that have been passed in the past to this script. It seems like past "clicks" to this CGI are persistant. I understand that these should be persistant for the life of the server process, but $vars should not be persistant, should it? The relevant code is as follows:

use strict; use warnings; use diagnostics; use Env; # Send errors to browser use CGI::Carp qw( fatalsToBrowser ); use CGI qw(:standard); my $query = CGI->new(); my %vars = $query->Vars(); # CGI.pm print header(), start_html(), and basic HTML goes here print p("\$vars{action} passed was: $vars{action}\n") if $vars{action} +;

Is there something I'm not seeing here? Should $vars be persistant throughout reloads? With more than one server process and more than one user hitting different options from the site, this could get very confusing and very ugly if a user clicks 'Download' and gets the 'News' page from the previous user's clicking.

I tried autoflushing at the top, but that didn't help. All of the possible variables are locals, not global, with the exception of those started in cgi-bin/startup.pl, as required by the Apache::Registry/mod_perl documentation.

Did I miss something?


In reply to "caching" issue with mod_perl? by hacker

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.