Here is a small patch to add $r->header_(in/out)() to Apache::compat

No tests for it yet, but it does work.

NOTE: table_set_get might be usefull elsewhere than in compat.pm.

/home/gozer/sources/mod_perl2/deps/perl/bin/perl build/cvsdiff lib/Apache/compat.pm 
todo
Index: lib/Apache/compat.pm
===================================================================
RCS file: /home/anoncvs/mod_perl-2-cvs/lib/Apache/compat.pm,v
retrieving revision 1.12
diff -u -I'$Id' -I'$Revision' -r1.12 compat.pm
--- lib/Apache/compat.pm        2001/09/15 17:57:25     1.12
+++ lib/Apache/compat.pm        2001/09/28 03:56:13
@@ -57,6 +57,35 @@
 
 package Apache::RequestRec;
 
+sub table_set_get {
+    my ($r,$table) = (shift,shift);
+    my ($key,$value) = @_;
+    
+    if (1 == @_) {
+        return $table->{$key};
+    }
+    elsif (2 == @_) {
+        return $table->{$key} = $value;
+    }
+    elsif (0 == @_) {
+        return $table;
+    }
+    else {
+        my $name = (caller(1))[3];
+        warn "Usage: $name([key [,val]])";
+    }
+}
+
+sub header_out {
+    my $r = shift;
+    return $r->table_set_get($r->headers_out(), @_);
+}
+
+sub header_in {
+    my $r = shift;
+    return $r->table_set_get($r->headers_in(), @_);
+}
+
 sub register_cleanup {
     shift->pool->cleanup_register(@_);
 }

Index: todo/api.txt
===================================================================
RCS file: /home/anoncvs/mod_perl-2-cvs/todo/api.txt,v
retrieving revision 1.5
diff -u -I'$Id' -I'$Revision' -r1.5 api.txt
--- todo/api.txt        2001/09/25 19:44:03     1.5
+++ todo/api.txt        2001/09/28 03:56:13
@@ -9,9 +9,6 @@
 need apr_finfo_t <-> struct stat conversion (might already be there,
 haven't looked close enough yet)
 
-$r->header_{in,out}:
-deprecated, but should be included in Apache::compat
-
 $r->pnotes:
 not yet implemented
 



-- 
Philippe M. Chiasson  <[EMAIL PROTECTED]>
  Extropia's Resident System Guru
     http://www.eXtropia.com/

Being an adult isn't about being grown up--it's about
realizing you need to grow up. 
        -- Larry Wall

perl -e '$$=\${gozer};{$_=unpack(P26,pack(L,$$));/^Just Another Perl 
Hacker!\n$/&&print||$$++&&redo}'

Attachment: msg01901/pgp00000.pgp
Description: PGP signature

Reply via email to