<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
# Apache::HttpEquiv.pm
#
# written by Rob Hartill (robh@imdb.com)
# last modified 31 December 1996
# version 1.0

package Apache::HttpEquiv;
use Apache ();

use vars qw($VERSION);
$VERSION = sprintf("%d.%02d", q$Revision: 1.0 $ =~ /(\d+)\.(\d+)/);

sub handler {
    my $r = shift;
    
    return 0 if # don't scan the file if..
	!$r-&gt;is_main # a subrequest
	    || $r-&gt;content_type ne "text/html" # it isn't HTML
		|| !open(FILE, $r-&gt;filename); # we can't open it
    
    local($/) = "\n";
    while(&lt;FILE&gt;) {
	last if m#&lt;BODY&gt;|&lt;/HEAD&gt;#i; # exit early if in BODY
	if (m#META-EQUIV="([^"]+)"\s+CONTENT="([^"]+)"#) {
	    $r-&gt;err_headers_out($1, $2);
	}
    }
    close(FILE);
    return 0;
}
1;
 
 __END__
 
=head1 NAME
 
Apache::HttpEquiv - Implements HTML B&lt;META_EQUIV&gt; tag parsing
 
=head1 SYNOPSIS
 
 (add to an Apache C&lt;.conf&gt; file)
 
 PerlModule Apache::HttpEquiv
 PerlFixupHandler Apache::HttpEquiv
 
=head1 DESCRIPTION
 
C&lt;Apache::HttpEquiv&gt; is a simple example of how to use the power of
B&lt;mod_perl&gt;
to customise your Apache server.
 
e.g.

 &lt;HTML&gt;
 &lt;HEAD&gt;&lt;TITLE&gt;My Away Page&lt;/TITLE&gt;
 &lt;META-EQUIV="Expires" CONTENT="Wed, 31 Dec 1997 16:40:00 GMT"&gt;
 &lt;META-EQUIV="Set-Cookie" CONTENT="open=sesame"&gt;
 &lt;/HTML&gt;
 
will cause the following extra C&lt;HTTP&gt; headers to be sent:
 
 Expires: Wed, 31 Dec 1997 16:40:00 GMT
 Set-Cookie: open=sesame
 
=head1 CONFIGURATION
 
This module needs mod_perl to be compiled with B&lt;PERL_FIXUP&gt;.
 
When configuring mod_perl say: 
 
 perl Makefile.PL PERL_FIXUP=1
 
=head1 SEE ALSO
 
mod_perl, perl(1), Apache(3)
 
=head1 AUTHOR
 
Rob Hartill &lt;robh@imdb.com&gt;

</pre></body></html>