in reply to How to force perl script to be refreshed

You can stop the browser reading a cached page by making all URIs unique.

You can do a quick-and-dirty by adding a random number to the URI's query string (as shown in test output below).

[ ~/tmp ] $ perl -wle 'use strict; print join("", "fred.pl", "?dummy=" +, rand)' fred.pl?dummy=0.67350901065311 [ ~/tmp ] $ perl -wle 'use strict; print join("", "fred.pl", "?dummy=" +, rand)' fred.pl?dummy=0.079789433236332 [ ~/tmp ] $ perl -wle 'use strict; print join("", "fred.pl", "?dummy=" +, rand)' fred.pl?dummy=0.844672383115725 [ ~/tmp ] $ perl -wle 'use strict; print join("", "fred.pl", "?dummy=" +, rand)' fred.pl?dummy=0.288386549874307 [ ~/tmp ] $

To guarantee uniqueness, you'll need to replace rand with a call to something that will return a unique value - possibly a custom-built application which returns a unique value, reading the nextval from an Oracle sequence or something along those lines.

Regards,

PN5

Replies are listed 'Best First'.
Re^2: How to force perl script to be refreshed
by stevecomrie (Beadle) on Oct 12, 2004 at 12:01 UTC
    using the epoch works just as well as random numbers.
    Perl: my $time = time; JavaScript: var now = new Date(); var epoch = now.getTime();
    Attach either of those to the end of a link and the browser will no cache the output.