This is really more of a HTTP- than Perl-related post; the following snippet emits all of the currently specified HTTP headers that may affect caching, with values set to coerce clients into not caching the document in question. It’s useful for debugging as well as generated pages that actually are very dynamic, but shouldn’t be used blindly for everything – caching is there for a reason.
(I’m posting this here mainly so as to have a node to refer people to as needed.)
Update 2006-01-12: added private and max-age=0 to the Cache-Control header.
use CGI qw(:standard);
use POSIX qw(strftime);
print header(
# date in the past
-expires => 'Sat, 26 Jul 1997 05:00:00 GMT',
# always modified
-Last_Modified => strftime('%a, %d %b %Y %H:%M:%S GMT', gmtime),
# HTTP/1.0
-Pragma => 'no-cache',
# HTTP/1.1 + IE-specific (pre|post)-check
-Cache_Control => join(', ', qw(
private
no-cache
no-store
must-revalidate
max-age=0
pre-check=0
post-check=0
)),
);
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|