[system] / trunk / webwork2 / lib / WeBWorK / Request.pm Repository:
ViewVC logotype

View of /trunk/webwork2/lib/WeBWorK/Request.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3973 - (download) (as text) (annotate)
Wed Jan 25 23:13:56 2006 UTC (7 years, 3 months ago) by sh002i
File size: 3360 byte(s)
forward-port from rel-2-2-dev: (update copyright date range -- 2000-2006.
this is probably overkill, since there are some files that were created
after 2000 and some files that were last modified before 2006.)

    1 ################################################################################
    2 # WeBWorK Online Homework Delivery System
    3 # Copyright © 2000-2006 The WeBWorK Project, http://openwebwork.sf.net/
    4 # $CVSHeader: webwork2/lib/WeBWorK/Request.pm,v 1.3 2005/11/07 21:18:13 sh002i 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 =back
   58 
   59 =cut
   60 
   61 =head1 METHODS
   62 
   63 =over
   64 
   65 =item ce([$new])
   66 
   67 Return the course environment (WeBWorK::CourseEnvironment) associated with this
   68 request. If $new is specified, set the course environment to $new before
   69 returning the value.
   70 
   71 =cut
   72 
   73 sub ce {
   74   my $self = shift;
   75   $self->{ce} = shift if @_;
   76   return $self->{ce};
   77 }
   78 
   79 =item db([$new])
   80 
   81 Return the database (WeBWorK::DB) associated with this request. If $new is
   82 specified, set the database to $new before returning the value.
   83 
   84 =cut
   85 
   86 sub db {
   87   my $self = shift;
   88   $self->{db} = shift if @_;
   89   return $self->{db};
   90 }
   91 
   92 =item authen([$new])
   93 
   94 Return the authenticator (WeBWorK::Authen) associated with this request. If $new
   95 is specified, set the authenticator to $new before returning the value.
   96 
   97 =cut
   98 
   99 sub authen {
  100   my $self = shift;
  101   $self->{authen} = shift if @_;
  102   return $self->{authen};
  103 }
  104 
  105 =item authz([$new])
  106 
  107 Return the authorizer (WeBWorK::Authz) associated with this request. If $new is
  108 specified, set the authorizer to $new before returning the value.
  109 
  110 =cut
  111 
  112 sub authz {
  113   my $self = shift;
  114   $self->{authz} = shift if @_;
  115   return $self->{authz};
  116 }
  117 
  118 =item urlpath([$new])
  119 
  120 Return the URL path (WeBWorK::URLPath) associated with this request. If $new is
  121 specified, set the URL path to $new before returning the value.
  122 
  123 =cut
  124 
  125 sub urlpath {
  126   my $self = shift;
  127   $self->{urlpath} = shift if @_;
  128   return $self->{urlpath};
  129 }
  130 
  131 =back
  132 
  133 =cut
  134 
  135 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9