You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@apache.org on 2001/09/28 15:51:57 UTC
cvs commit: modperl-2.0/todo api.txt
dougm 01/09/28 06:51:57
Modified: lib/Apache compat.pm
todo api.txt
Log:
add $r->header_(in/out)() to Apache::compat
Submitted by: Philippe M . Chiasson <go...@cpan.org>
Reviewed by: dougm
Revision Changes Path
1.13 +29 -0 modperl-2.0/lib/Apache/compat.pm
Index: compat.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- compat.pm 2001/09/15 17:57:25 1.12
+++ compat.pm 2001/09/28 13:51:57 1.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(scalar $r->headers_out, @_);
+}
+
+sub header_in {
+ my $r = shift;
+ return $r->table_set_get(scalar $r->headers_in, @_);
+}
+
sub register_cleanup {
shift->pool->cleanup_register(@_);
}
1.6 +0 -3 modperl-2.0/todo/api.txt
Index: api.txt
===================================================================
RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- api.txt 2001/09/25 19:44:03 1.5
+++ api.txt 2001/09/28 13:51:57 1.6
@@ -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
Re: cvs commit: modperl-2.0/todo api.txt
Posted by Doug MacEachern <do...@covalent.net>.
On Fri, 28 Sep 2001, Philippe M . Chiasson wrote:
> Aie ! There is a slight problem with this patch, as was pointed out by Stas a while ago.
>
> Blame it on the annoying TZ lag introduced in e-mail when living in Singapore ;-)
>
> This patch works, but doesn't preserve ARRAY context, thus:
ok. could probably just pass wantarray to table_get_set and do:
return $wantarray ? ($table->get($key)) : scalar $table->get($key)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: cvs commit: modperl-2.0/todo api.txt
Posted by Doug MacEachern <do...@covalent.net>.
On Fri, 28 Sep 2001, Philippe M . Chiasson wrote:
> Aie ! There is a slight problem with this patch, as was pointed out by Stas a while ago.
>
> Blame it on the annoying TZ lag introduced in e-mail when living in Singapore ;-)
>
> This patch works, but doesn't preserve ARRAY context, thus:
ok. could probably just pass wantarray to table_get_set and do:
return $wantarray ? ($table->get($key)) : scalar $table->get($key)
Re: cvs commit: modperl-2.0/todo api.txt
Posted by "Philippe M . Chiasson" <go...@cpan.org>.
Aie ! There is a slight problem with this patch, as was pointed out by Stas a while ago.
Blame it on the annoying TZ lag introduced in e-mail when living in Singapore ;-)
This patch works, but doesn't preserve ARRAY context, thus:
my @list = $r->header_in("foo");
will not work ;(
On Fri, Sep 28, 2001 at 01:51:57PM -0000, dougm@apache.org wrote:
> dougm 01/09/28 06:51:57
>
> Modified: lib/Apache compat.pm
> todo api.txt
> Log:
> add $r->header_(in/out)() to Apache::compat
> Submitted by: Philippe M . Chiasson <go...@cpan.org>
> Reviewed by: dougm
>
> Revision Changes Path
> 1.13 +29 -0 modperl-2.0/lib/Apache/compat.pm
>
> Index: compat.pm
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
> retrieving revision 1.12
> retrieving revision 1.13
> diff -u -r1.12 -r1.13
> --- compat.pm 2001/09/15 17:57:25 1.12
> +++ compat.pm 2001/09/28 13:51:57 1.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(scalar $r->headers_out, @_);
> +}
> +
> +sub header_in {
> + my $r = shift;
> + return $r->table_set_get(scalar $r->headers_in, @_);
> +}
> +
> sub register_cleanup {
> shift->pool->cleanup_register(@_);
> }
>
>
>
> 1.6 +0 -3 modperl-2.0/todo/api.txt
>
> Index: api.txt
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- api.txt 2001/09/25 19:44:03 1.5
> +++ api.txt 2001/09/28 13:51:57 1.6
> @@ -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 <go...@cpan.org>
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}'
Re: cvs commit: modperl-2.0/todo api.txt
Posted by "Philippe M . Chiasson" <go...@cpan.org>.
Aie ! There is a slight problem with this patch, as was pointed out by Stas a while ago.
Blame it on the annoying TZ lag introduced in e-mail when living in Singapore ;-)
This patch works, but doesn't preserve ARRAY context, thus:
my @list = $r->header_in("foo");
will not work ;(
On Fri, Sep 28, 2001 at 01:51:57PM -0000, dougm@apache.org wrote:
> dougm 01/09/28 06:51:57
>
> Modified: lib/Apache compat.pm
> todo api.txt
> Log:
> add $r->header_(in/out)() to Apache::compat
> Submitted by: Philippe M . Chiasson <go...@cpan.org>
> Reviewed by: dougm
>
> Revision Changes Path
> 1.13 +29 -0 modperl-2.0/lib/Apache/compat.pm
>
> Index: compat.pm
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
> retrieving revision 1.12
> retrieving revision 1.13
> diff -u -r1.12 -r1.13
> --- compat.pm 2001/09/15 17:57:25 1.12
> +++ compat.pm 2001/09/28 13:51:57 1.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(scalar $r->headers_out, @_);
> +}
> +
> +sub header_in {
> + my $r = shift;
> + return $r->table_set_get(scalar $r->headers_in, @_);
> +}
> +
> sub register_cleanup {
> shift->pool->cleanup_register(@_);
> }
>
>
>
> 1.6 +0 -3 modperl-2.0/todo/api.txt
>
> Index: api.txt
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- api.txt 2001/09/25 19:44:03 1.5
> +++ api.txt 2001/09/28 13:51:57 1.6
> @@ -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 <go...@cpan.org>
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}'