Hello.
We are using WeBWorK for administering advanced placement tests for Math. I've been asked to automate the export of test scores from WebWork and import them into our Student Information System (Banner).
I've taken a look at wwScoreGetter by Gavin LaRose. Thank you for sharing that, Gavin.
I've started constructing my own script, using the same modules that wwScoreGetter uses:
#!/usr/bin/perl -w
use strict;
my $wwHome = '/opt/webwork/webwork2';
my $wwCourseDir = "$wwHome/courses";
my $courseName = "Math_Placement_2014";
# set environment variables to allow use of WeBWorK scripts
# to get these set correctly will probably require running this from
# a wrapper
$ENV{WEBWORK_ROOT} = $wwHome;
$ENV{WEBWORK_DIRECTORY} = $wwHome;
$ENV{MOD_PERL_API_VERSION}=2;
use lib '/opt/webwork/pg/lib';
use lib '/opt/webwork/webwork2/lib';
use WeBWorK::PG::ImageGenerator;
use WeBWorK::CourseEnvironment;
use WeBWorK::DB;
use WeBWorK::ContentGenerator;
use WeBWorK::ContentGenerator::Instructor;
use WeBWorK::ContentGenerator::Instructor::Scoring;
exit;
When I run this, I get the following errors (separated with blank lines for readability):
Use of uninitialized value in concatenation (.) or string at /opt/webwork/webwork2/lib/WeBWorK/Localize.pm line 10.
Localize.pm: Full path for the localization directory set to |/lib/WeBWorK/Localize|
Use of uninitialized value in concatenation (.) or string at /opt/webwork/webwork2/lib/WeBWorK/Localize.pm line 11.
Subroutine WeBWorK::Localize::loc redefined at /usr/lib/perl5/site_perl/5.8.8/Locale/Maketext/Simple.pm line 123.
Subroutine WeBWorK::Localize::loc_lang redefined at /usr/lib/perl5/site_perl/5.8.8/Locale/Maketext/Simple.pm line 124.
Can't locate mod_perl.pm in @INC (@INC contains: /opt/webwork/webwork2/lib /opt/webwork/pg/lib /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm line 56.
BEGIN failed--compilation aborted at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm line 56.
Compilation failed in require at ./wwaccess.pl line 22.
BEGIN failed--compilation aborted at ./wwaccess.pl line 22.
(Line 22 is "use WeBWorK::ContentGenerator;")
There seems to be at least 2 issues I'm facing here:
1.) It looks like the value of the WEBWORK_ROOT environment variable is not making it to Localize.pm. I've tried a wrapper script with the same results:
#!/bin/sh
WEBWORK_ROOT='/opt/webwork/webwork2'
export WEBWORK_ROOT
WEBWORK_DIRECTORY='/opt/webwork/webwork2'
export WEBWORK_DIRECTORY
MOD_PERL_API_VERSION=2
export MOD_PERL_API_VERSION
./wwaccess.pl
2.) ContentGenerator.pm needs mod_perl.pm and it can't be found. It's not installed, and when I try to install it from CPAN, it wants access to Apache source code, which is not on the host system. I don't know anything about how WebWork or Apache was installed on this machine (RedHat 5).
I think mod_perl2 is installed, based on what I've seen at http://localhost/server-info.
I'm working from a position of ignorance here. I wasn't involved in the installation and configuration of this box or the software. I'm just a dumb programmer.
Any advice on these issues would be greatly appreciated.
—Steve