[system] / trunk / pg / lib / AnswerIO.pm Repository:
ViewVC logotype

View of /trunk/pg/lib/AnswerIO.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1079 - (download) (as text) (annotate)
Mon Jun 9 17:36:12 2003 UTC (16 years, 8 months ago) by apizer
File size: 1252 byte(s)
removed unneccesary shebang lines

    1 
    2 
    3 =head1 NAME
    4 
    5   AnswerIO.pm
    6 
    7 =head1 SYNPOSIS
    8 
    9 This is not really an object, but it gives us a place to IO used by answer
   10 macros.
   11 
   12 
   13 
   14 =head1 DESCRIPTION
   15 
   16 
   17 =head2 Examples:
   18 
   19 
   20 
   21 =cut
   22 
   23 
   24 BEGIN {
   25   be_strict(); # an alias for use strict.  This means that all global variable must contain main:: as a prefix.
   26 }
   27 
   28 package AnswerIO;
   29 
   30 
   31 
   32 # Code for saving Answers to a file
   33 # function, not a method
   34 # Code in .pm files can access the disk.
   35 
   36 
   37 sub saveAnswerToFile {
   38     my $logFileID = shift;
   39       my $string = shift;
   40       # We want to allow acces only to predetermined files
   41       # We accomplish this by translating legal IDs into a file name
   42 
   43       my $rh_allowableFiles = {preflight => 'preflight.log',
   44 
   45         };
   46       my $error=undef;
   47       my $logFileName = $rh_allowableFiles->{$logFileID};
   48       if ( defined($logFileName) ) {
   49         my $accessLog = Global::getCourseLogsDirectory().$logFileName;
   50         #$error = "access Log is $accessLog";
   51         #$error .="string is $string";
   52         open(LOG, ">>$accessLog") or $error.= "Can't open course access log $accessLog";
   53         print LOG $string;  #no format is forced on data.
   54         close(LOG);
   55       } else {
   56         $error = "Error: The file ID $logFileID is not recognized.";
   57       }
   58   return $error ;
   59 }
   60 
   61 
   62 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9