Installation

Not a GLOB reference

Not a GLOB reference

by Jeremy Sylvestre -
Number of replies: 7
Hi, I'm trying to install v2.14 (fresh, not an upgrade).

Getting a weird error when webwork tries to read defaults.config, seems to be a show stopper for me:

> perl -e '
use lib "/opt/webwork/webwork2/lib";
use WeBWorK::CourseEnvironment;
my $ce = new WeBWorK::CourseEnvironment({ webwork_dir => "/opt/webwork/webwork2" });
'
Not a GLOB reference at /opt/webwork/webwork2/lib/WeBWorK/CourseEnvironment.pm line 200.



I haven't modified defaults.config at all.

Using perl v5.28.2.

???

Thanks,
Jeremy S.

In reply to Jeremy Sylvestre

Re: Not a GLOB reference

by Michael Gage -
What you wrote works for me (no errors, and $ce is created. )
using branch WeBWorK-2.15 and perl 12 (I know that's a little old).
I don't believe the recent branches have had much testing against newer perls.
the error could be in any of the config files site.conf, defaults.config, localOverrides.conf or courseName/course.conf
They are all read while
creating the CourseEnvironment.
or it could be that the newest perl is strict about something that has passed muster before.

-- Mike

CourseEnvironment is dealing with the Safe compartment and namespaces
around line 200 so it could very well be a change in perl.
In reply to Michael Gage

Re: Not a GLOB reference

by Jeremy Sylvestre -
OK, a little more investigating and it appears that the

foreach my $name (keys %symbolHash)

loop (line 196) was barfing in the case of $name value "include".

Is "include" an "internal symbol" that should be "weeded out" ? (See the comment on line 197.)

Changing line 198 from

next if $name =~ /^(INC|_.*|__ANON__|main::)$/;

to

next if $name =~ /^(INC|_.*|__ANON__|main::|include)$/;

allows the

new WeBWorK::CourseEnvironment

call in webwork.apache2.4-config to complete without error, but I have no idea what side effects the above change might have....

Cheers,
Jeremy S.

In reply to Jeremy Sylvestre

Re: Not a GLOB reference

by Michael Gage -
Nice work.

I'm not sure about side effects either. There is an anonymous function stored in $include which is defined in CourseEnvironment and used to read the chain of configuration files. I don't know whether it is involved and I'm not sure why this changes from one perl to another -- but since it involves GLOBs I'm not shocked that the perl interpreter might change behavior.

My first guess is that there will be no side-effects but we should keep this even in mind if something else weird come up.

You can put in a "next unless exists $name" type statement in the loop so that it doesn't blow up -- but you have probably already done that. If nothing goes wrong for a while you can submit a pull request and we'll check to see if that also works fine for earlier versions of perl.

Thanks.
-- Mike

-- Mike
In reply to Jeremy Sylvestre

Re: Not a GLOB reference

by Nathan Wallach -
Jeremy -

Could you add
if ( $name =~ /include/ ) {
warn "include has value $symbolHash{$name}\n\n";
}
just before the modified "next" line and report on the output.

On Perl 5.22.1 I get the output:
include has value *main::include
from that line, but no fatal error.

Tani
In reply to Jeremy Sylvestre

Re: Not a GLOB reference

by George Jennings -
I had the same issue with webwork 2.15 on Ubuntu 19.04 running perl 5 ver. 28. Jeremy's repair cured the problem. Thanks!
In reply to Michael Gage

Re: Not a GLOB reference

by Nathan Wallach -
The Docker environment we are using (by default) is based on Ubuntu 16.04 and has Perl v5.22.1 and does not hit this problem. However, Florian Heiderich reported getting the same error message
Not a GLOB reference at /opt/webwork/webwork2/lib/WeBWorK/CourseEnvironment.pm line 200.
when he tried to change Dockerfile to use Ubuntu 19.04 as the base system (but that it does not happen with Ubuntu 18.04).

I am guessing that Florian's report is also related to a newer version of Perl in that base OS and the same underlying change to Perl.