[system] / branches / rel-2-4-patches / webwork-modperl / lib / WeBWorK / Request.pm Repository:
ViewVC logotype

Diff of /branches/rel-2-4-patches/webwork-modperl/lib/WeBWorK/Request.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 4192 Revision 4193
1################################################################################ 1################################################################################
2# WeBWorK Online Homework Delivery System 2# WeBWorK Online Homework Delivery System
3# Copyright © 2000-2006 The WeBWorK Project, http://openwebwork.sf.net/ 3# Copyright © 2000-2006 The WeBWorK Project, http://openwebwork.sf.net/
4# $CVSHeader: webwork2/lib/WeBWorK/Request.pm,v 1.4 2006/01/25 23:13:51 sh002i Exp $ 4# $CVSHeader: webwork2/lib/WeBWorK/Request.pm,v 1.5 2006/06/29 23:20:47 sh002i Exp $
5# 5#
6# This program is free software; you can redistribute it and/or modify it under 6# This program is free software; you can redistribute it and/or modify it under
7# the terms of either: (a) the GNU General Public License as published by the 7# the terms of either: (a) the GNU General Public License as published by the
8# Free Software Foundation; either version 2, or (at your option) any later 8# Free Software Foundation; either version 2, or (at your option) any later
9# version, or (b) the "Artistic License" which comes with this package. 9# version, or (b) the "Artistic License" which comes with this package.
39 require Apache::Request; 39 require Apache::Request;
40 Apache::Request->import; 40 Apache::Request->import;
41 push @WeBWorK::Request::ISA, "Apache::Request"; 41 push @WeBWorK::Request::ISA, "Apache::Request";
42 } 42 }
43} 43}
44
45# Apache2::Request's param method doesn't support setting parameters, so we need to provide the
46# behavior in this class if we're running under mod_perl2.
47BEGIN {
48 if (MP2) {
49 *param = sub {
50 my $self = shift;
51 if (@_ == 0) {
52 my %names;
53 @names{$self->SUPER::param} = ();
54 @names{keys %{$self->{paramcache}}} = ();
55 return keys %names;
56 } elsif (@_ == 1) {
57 my $name = shift;
58 if (exists $self->{paramcache}{$name}) {
59 my $val = $self->{paramcache}{$name};
60 if (ref $val eq "ARRAY") {
61 return @$val;
62 } else {
63 return $val;
64 }
65 } else {
66 return $self->SUPER::param($name);
67 }
68 } elsif (@_ == 2) {
69 my ($name, $val) = @_;
70 $self->{paramcache}{$name} = $val;
71 if (ref $val eq "ARRAY") {
72 return @$val;
73 } else {
74 return $val;
75 }
76 }
77 }
78 }
79}
80
44 81
45=head1 CONSTRUCTOR 82=head1 CONSTRUCTOR
46 83
47=over 84=over
48 85

Legend:
Removed from v.4192  
changed lines
  Added in v.4193

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9