This patch also preserves list context where required

/home/gozer/sources/mod_perl2/deps/perl/bin/perl build/cvsdiff t lib
Index: t/apache/compat.t
===================================================================
RCS file: /home/anoncvs/mod_perl-2-cvs/t/apache/compat.t,v
retrieving revision 1.2
diff -u -I'$Id' -I'$Revision' -r1.2 compat.t
--- t/apache/compat.t   2001/09/29 19:33:39     1.2
+++ t/apache/compat.t   2001/10/01 07:25:54
@@ -6,7 +6,7 @@
 use Apache::TestUtil;
 use Apache::TestRequest;
 
-plan tests => 11, todo => [5,7,9,11], \&have_lwp;
+plan tests => 11, \&have_lwp;
 
 my $location = "/TestApache::compat";
 

Index: lib/Apache/compat.pm
===================================================================
RCS file: /home/anoncvs/mod_perl-2-cvs/lib/Apache/compat.pm,v
retrieving revision 1.14
diff -u -I'$Id' -I'$Revision' -r1.14 compat.pm
--- lib/Apache/compat.pm        2001/09/28 17:15:07     1.14
+++ lib/Apache/compat.pm        2001/10/01 07:25:54
@@ -59,10 +59,15 @@
     my($key, $value) = @_;
 
     if (1 == @_) {
-        return $table->{$key};
+        return wantarray() ? ($table->get($key)) : scalar($table->get($key));
     }
     elsif (2 == @_) {
-        return $table->{$key} = $value;
+        if (defined $value) {
+            return wantarray() ? ($table->set($key, $value)) : 
+scalar($table->set($key, $value));
+        }
+        else {
+            return wantarray() ? ($table->unset($key)) : scalar($table->unset($key));
+        }
     }
     elsif (0 == @_) {
         return $table;
@@ -75,12 +80,12 @@
 
 sub header_out {
     my $r = shift;
-    return $r->table_set_get(scalar $r->headers_out, @_);
+    return wantarray() ? ($r->table_set_get(scalar $r->headers_out, @_)) : 
+scalar($r->table_set_get(scalar $r->headers_out, @_));
 }
 
 sub header_in {
     my $r = shift;
-    return $r->table_set_get(scalar $r->headers_in, @_);
+    return wantarray() ? ($r->table_set_get(scalar $r->headers_in, @_)) : 
+scalar($r->table_set_get(scalar $r->headers_in, @_));
 }
 
 sub register_cleanup {


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

Perl appeals to the other side of your brain, whether
that's
associate, artistic, passionate, or merely spongy.
        -- Larry Wall

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

PGP signature

Reply via email to