in reply to Trouble Caching an Image
First, use strict; at the top of the module will keep you out of a lot of trouble.
Next, use CGI; and using it to parse URLs and forms will keep you out of even more trouble. "As simple as possible" is not a good argument. The code you provided would be shorter if you used CGI. (If you're worried about performance, consider CGI::Lite.) In this case, never mind.
Next, if you're running a current (or nearly current) Perl distribution, the date manipulation routines you need should be included, saving you the trouble of lugging around custom methods of uncertain ancestry.
Try something like the following fragment:
Finally, one of the subtle problems you'll have is that getting expire times to work depends on a couple of things that might be out of your control.use HTTP::Date qw(time2str); my $now = time2str($filetime); my $expires = time2str($filetime + $delta); print "Last-modified: $now\n"; print "Expires: $expires\n";
Treat setting the Expires header as an optimization, and be prepared to have it ignored.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Trouble Caching an Image
by Baz (Friar) on Sep 04, 2002 at 22:05 UTC |