perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From will trillich <>
Subject perlSendHeader On/Off: the difference!
Date Sun, 02 Jul 2000 08:49:07 GMT
perlSendHeader On / Off -- what's the real difference?
i finally figured it out, after seeing many 'server errors'
on one hand, and http headers cluttering up the html output
to the browser on the other...

i have a perl script
and a symbolic link to it
	`ln -s test.npl`
so that the same code will be called whether it's
*.pl or *.npl...

and in httpd.conf,
   <FilesMatch "\.(pl|perl)">
        Options +ExecCGI
        SetHandler perl-script
        PerlSendHeader On
        PerlHandler Apache::PerlRun
   <FilesMatch "\.((nph|n)-?)(pl|perl)">
        Options +ExecCGI
        SetHandler perl-script
        PerlSendHeader Off
        PerlHandler Apache::PerlRun

so any script named *.pl runs with perlSendHeader ON;
any script named *.npl runs with perlSendHeader OFF.

here's the relevant code from the top of the script:

my $eol  = "\015\012";
my $mod  = scalar localtime( $seen{$path} ||= (stat $path)[9] );
my $span = 60*60*24;
print "HTTP/1.1 200 OK",$eol
      if $0 =~ /\.npl$/	# if PERLSENDHEADER == OFF, say 'HTTP/...'
print "Content-Type: text/html",$eol,
      "Last-Modified: ",$mod,$eol,
      "Date: ",scalar(localtime),$eol,
      "Expires: ",scalar(localtime(time+$span)),$eol,
print "<html>"....

and the script behaves identically, whether called
as *.npl or *.pl, with no server error (missing headers)
and no http clutter at the top of html output (extra

thus i conclude that (aside from the internals revealed at
) PERLSENDHEADER ON makes mod_perl generate the initial
'HTTP' intro, and that's that.

yes? no? do i win a prize?

Their is five errers in this sentance.

View raw message