WeBWorK Main Forum

PERL errors with most of the problems, using rel-2-4-patches

PERL errors with most of the problems, using rel-2-4-patches

by Sarunas Burdulis -
Number of replies: 5
Hi,

We are running Webwork 2.4 updated from CVS (rel-2-4-patches) with Apache 2.2 on amd64 Ubuntu 8.04.

/server-info:
Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.3 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g mod_apreq2-20051231/2.6.0 mod_perl/2.0.3 Perl/v5.8.8

The system worked fine last spring and wasn't much used during the summer. I have just updated Webwork from CVS (the OS is up to date as well) and noticed that most of the problems now produce PERL errors and won't display. A few problems still display, but produce warnings (please see Error and Warning messages inserted below). Has anyone experienced this? Any ideas for a fix? I have found a similar thread (http://wwrk.maa.org/moodle/mod/forum/discuss.php?d=530), but the suggested 'no strict "refs";' is already present in Context.pm version from CVS. Changing to $pg{specialPGEnvironmentVars}{useOldAnswerMacros} = 1 doesn't help either.

Thanks
Sarunas Burdulis

Error messages
Can't locate object method "getCopy" via package "Parser::Context" at line 978 of [PG]/macros/PGnumericevaluators.pl Died within main::NUM_CMP called at line 411 of [PG]/macros/PGnumericevaluators.pl from within main::num_cmp called at line 731 of [PG]/macros/PGnumericevaluators.pl from within main::arith_num_cmp called at line 32 of [TMPL]/set0/prob5.pg
Error details
Problem7
ERROR caught by Translator while processing problem file:set0/prob5.pg
****************
Can't locate object method "getCopy" via package "Parser::Context" at line 978 of [PG]/macros/PGnumericevaluators.pl
Died within main::NUM_CMP called at line 411 of [PG]/macros/PGnumericevaluators.pl
from within main::num_cmp called at line 731 of [PG]/macros/PGnumericevaluators.pl
from within main::arith_num_cmp called at line 32 of [TMPL]/set0/prob5.pg

****************

------Input Read
1 ##DESCRIPTION
2 ## practice problem
3 ##ENDDESCRIPTION
4
5 ##KEYWORDS('sample')
6
7 DOCUMENT(); # This should be the first executable line in the problem.
8
9 loadMacros(
10 "PG.pl",
11 "PGbasicmacros.pl",
12 "PGchoicemacros.pl",
13 "PGanswermacros.pl",
14 "PGauxiliaryFunctions.pl"
15 );
... ... ...


Warning messages
Failed to evaluate module Parser: Undefined subroutine &Scalar::Util::weaken called at /opt/webwork/pg/lib/Value/Context/Data.pm line 62.
BEGIN failed--compilation aborted at /opt/webwork/pg/lib/Value.pm line 132.
Compilation failed in require at /opt/webwork/pg/lib/Parser.pm line 786.
BEGIN failed--compilation aborted at /opt/webwork/pg/lib/Parser.pm line 786.
Compilation failed in require at (eval 973) line 1.
Failed to evaluate module Value: Undefined subroutine &Scalar::Util::weaken called at /opt/webwork/pg/lib/Value/Context/Data.pm line 62.
BEGIN failed--compilation aborted at /opt/webwork/pg/lib/Value.pm line 132.
Compilation failed in require at /opt/webwork/pg/lib/Parser.pm line 786.
BEGIN failed--compilation aborted at /opt/webwork/pg/lib/Parser.pm line 786.
Compilation failed in require at (eval 973) line 1.
Failed to evaluate module Parser::Legacy: Can't call method "copy" on an undefined value at /opt/webwork/pg/lib/Parser/Legacy/LimitedNumeric.pm line 81.
Compilation failed in require at /opt/webwork/pg/lib/Parser/Legacy.pm line 6.
BEGIN failed--compilation aborted at /opt/webwork/pg/lib/Parser/Legacy.pm line 6.
Compilation failed in require at (eval 974) line 1.
In reply to Sarunas Burdulis

Re: PERL errors with most of the problems, using rel-2-4-patches

by Michael Gage -
Check to see if the CPAN module Scalar::Util is installed.

(this module has not yet been added to the check_modules.pl script -- it should be.)

This module was added last fall and provides the subroutine needed to correct a memory leak that existed in earlier versions of MathObjects:

Formula objects and Context objects contain reference loops, which
prevent them from being freed properly by perl when they are no longer
needed. This is a source of an important memory leak in WeBWorK. The
problem has been fixed by using Scalar::Util::weaken for these
recursive references, so these objects can be freed properly when they
go out of scope. This should cause an improvement in the memory usage
of the httpd child processes.

In reply to Michael Gage

Re: PERL errors with most of the problems, using rel-2-4-patches

by Matthew Leventi -
I just had a problem that was very similar. It was fixed by adding Parser::Legacy to the preloaded module list in the global configuration file. I don't know if there is a reason why that was taken out?

-Matt
In reply to Matthew Leventi

Re: PERL errors with most of the problems, using rel-2-4-patches

by Michael Gage -
Parser::Legacy is included in my copy of the global.conf.dist file
(rel-2-4-patches) -- in any case it does need to be included.

--Mike

In reply to Matthew Leventi

Re: PERL errors with most of the problems, using rel-2-4-patches

by Sarunas Burdulis -
I still have Parser::Legacy in ${pg}{modules} in global.conf.

Sarunas
In reply to Michael Gage

Re: PERL errors with most of the problems, using rel-2-4-patches

by Sarunas Burdulis -
Thanks for the hint. Scalar::Util was installed. Strangely, Scalar/Util.pm was present both in /usr/local/lib/perl/ and /usr/local/share/perl/. Moved both away, reinstalled with cpan> install Scalar::Utils, restarted Apache, and all the Webwork errors and warnings are gone. Comparing newly installed Util.pm with the "old" one the diff is zero. Not sure what is going on here...

Sarunas