[LON-CAPA-cvs] cvs: modules /jerf/tests Apache.pm

bowersj2 lon-capa-cvs@mail.lon-capa.org
Thu, 29 May 2003 20:20:55 -0000

bowersj2		Thu May 29 16:20:55 2003 EDT

  Added files:                 
    /modules/jerf/tests	Apache.pm 
  File for simulating the Apache module.

Index: modules/jerf/tests/Apache.pm
+++ modules/jerf/tests/Apache.pm
# The LearningOnline Network with CAPA
# Apache package simulator for testing
# $Id: Apache.pm,v 1.1 2003/05/29 20:20:55 bowersj2 Exp $
# Copyright Michigan State University Board of Trustees
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
# /home/httpd/html/adm/gpl.txt
# http://www.lon-capa.org/
# (Testing: Apache Package simulator

package Apache;

# This simulates the $Apache::request object. 
my $requestObject;


=head1 Apache package simulator

For testing purposes, this package simulates the Apache package. 

Right now it doesn't export anything, which is incorrect but will be
fixed as needed.

=head2 Simulated functionality

=over 4

=item * I<request>($requestObj): If called with no argument, it returns the
    last ApacheRequest object created. If called with the argument, it changes
    the value this function returns to the given object.



sub request {
    my $arg = shift;
    # if it's being called via Apache->request, discard the package ref
    if ($arg eq 'Apache') { $arg = shift; }
    if (!defined($arg)) { 
	return $requestObject;
    } else {
	$requestObject = $arg;