Parent Directory
|
Revision Log
added URLPath and Request, for dispatch_new
1 ################################################################################ 2 # WeBWorK Online Homework Delivery System 3 # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ 4 # $CVSHeader: webwork-modperl/lib/WeBWorK.pm,v 1.49 2004/02/21 10:15:58 toenail Exp $ 5 # 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 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. 10 # 11 # This program is distributed in the hope that it will be useful, but WITHOUT 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 # FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the 14 # Artistic License for more details. 15 ################################################################################ 16 17 package WeBWorK::Request; 18 use base qw(Apache::Request); 19 20 =head1 NAME 21 22 WeBWorK::Request - a request to the WeBWorK system, a subclass of 23 Apache::Request with additional WeBWorK-specific fields. 24 25 =cut 26 27 use strict; 28 use warnings; 29 30 =head1 CONSTRUCTOR 31 32 =over 33 34 =item new(@args) 35 36 Creates an new WeBWorK::Request. All arguments are passed to Apache::Request's 37 constructor. You must specify at least an Apache request_rec object. 38 39 =for comment 40 41 From: http://search.cpan.org/~joesuf/libapreq-1.3/Request/Request.pm#SUBCLASSING_Apache::Request 42 43 If the instances of your subclass are hash references then you can actually 44 inherit from Apache::Request as long as the Apache::Request object is stored in 45 an attribute called "r" or "_r". (The Apache::Request class effectively does the 46 delegation for you automagically, as long as it knows where to find the 47 Apache::Request object to delegate to.) 48 49 =cut 50 51 sub new { 52 my ($invocant, @args) = @_; 53 my $class = ref $invocant || $invocant; 54 return bless { r => Apache::Request->new(@args) }, $class; 55 } 56 57 =head1 METHODS 58 59 =over 60 61 =item ce([$new]) 62 63 Return the course environment (WeBWorK::CourseEnvironment) associated with this 64 request. If $new is specified, set the course environment to $new before 65 returning the value. 66 67 =cut 68 69 sub ce { 70 my $self = shift; 71 $self->{ce} = shift if @_; 72 return $self->{ce}; 73 } 74 75 =item db([$new]) 76 77 Return the database (WeBWorK::DB) associated with this request. If $new is 78 specified, set the database to $new before returning the value. 79 80 =cut 81 82 sub db { 83 my $self = shift; 84 $self->{db} = shift if @_; 85 return $self->{db}; 86 } 87 88 =item authz([$new]) 89 90 Return the authorizer (WeBWorK::Authz) associated with this request. If $new is 91 specified, set the authorizer to $new before returning the value. 92 93 =cut 94 95 sub authz { 96 my $self = shift; 97 $self->{authz} = shift if @_; 98 return $self->{authz}; 99 } 100 101 =item urlpath([$new]) 102 103 Return the URL path (WeBWorK::URLPath) associated with this request. If $new is 104 specified, set the URL path to $new before returning the value. 105 106 =cut 107 108 sub urlpath { 109 my $self = shift; 110 $self->{urlpath} = shift if @_; 111 return $self->{urlpath}; 112 } 113 114 =back 115 116 =cut 117 118 1;
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |