Hi,

why are you not using the header functions provided by mod_perl, the
problem you're having is described here:

http://perl.apache.org/docs/2.0/user/coding/coding.html#Generating_HTTP_Response_Headers

Things used here:
http://perl.apache.org/docs/2.0/api/APR/Table.html#C_set_
http://perl.apache.org/docs/2.0/api/Apache/RequestRec.html#C_headers_out_

-----------------------------8<-----------------------------
my $r = Apache->request;
$r->content_type("text/html");

$r->headers_out->set("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
$r->headers_out->set("Last-Modified", gmtime(time) . " GMT");
$r->headers_out->set("Cache-Control", "no-cache");
$r->headers_out->set("Cache-Control", "post-check=0, pre-check=0");
$r->headers_out->set("Pragma", "no-cache");
$r->headers_out->set("Character-Set", "windows-1251");
$r->headers_out->set("Content-Type", "text/html;charset=windows-1251");

$r->print("mod_perl rules!");

1;
-----------------------------8<-----------------------------

Tom
Vadim wrote:
I found a lot of useful information in "perldoc Apache::Status" (thanks Ruslan)

But i still have a problem.
When i run this script under ModPerl::Registry for several times, i get the warrning in the my error.log
[Thu Jul 08 21:55:04 2004] [warn] /perl/test.pl did not send an HTTP header


Why so it? Please, direct me to respective manual.

So, test.pl
-----------------------------
#!/usr/bin/perl -w
package Headers;
use strict;
sub new         {

my $this = shift;
my $class = ref($this) || $this;
my $self = {};
bless $self, $class;
$self->{headers} = {
"Expires" => "Mon, 26 Jul 1997 05:00:00 GMT",
"Last-Modified" => gmtime(time) . " GMT",
"Cache-Control" => "no-cache",
"Cache-Control" => "post-check=0, pre-check=0",
"Pragma" => "no-cache",
"Character-Set" => "windows-1251",
"Content-Type" => "text/html; charset=windows-1251",
};
return $self;
}
sub print {
my $self = shift;
print $_, ": ", $self->{headers}->{$_}, "\n" for keys %{ $self->{headers} };
print "\n";
}




package main;
use strict;
use warnings;


our $HEADERS = new Headers; $HEADERS->print(); print 1;

-----------------------------




On Thu, 2004-07-08 at 12:09, Vadim wrote:

Are there any way to dump all cached vars for scripts under mod_perl?

Can you explain what you mean by "cached vars"? Are you talking about global variables?

- Perrin




Reclaim Your Inbox!
http://www.mozilla.org/products/thunderbird

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to