Global symbol "%Config" requires explicit package at at C:/Perl/lib/Time/Local .pm line 27.

C

charlieskc

Hi all,

I am try to test my perl script, with just a few line:

use Time::Local 'timelocal_nocheck'; {
# The 365th day of 1999
print scalar localtime timelocal_nocheck 0,0,0,365,0,99;

}

but when I compile, it prompts error that "Global symbol "%Config"
requires explicit package at at C:/Perl/lib/Time/Local.pm line 27."

in C:/Perl/lib/Time/Local.pm line 27: my $MaxInt = ((1<<(8 *
$Config{intsize} - 2))-1)*2 + 1;

I think I set something wrong in the environment setting, could you
please figure out why I have such error occur? many thanks!!!
Regards,
Charlie
 
A

A. Sinan Unur

I am try to test my perl script, with just a few line:

use Time::Local 'timelocal_nocheck'; {
# The 365th day of 1999
print scalar localtime timelocal_nocheck 0,0,0,365,0,99;

}

That runs perfectly fine on my system. I don't think you posted the
complete script. Please read the posting guidelines for
comp.lang.perl.misc.
but when I compile, it prompts error that "Global symbol "%Config"
requires explicit package at at C:/Perl/lib/Time/Local.pm line 27."

in C:/Perl/lib/Time/Local.pm line 27: my $MaxInt = ((1<<(8 *
$Config{intsize} - 2))-1)*2 + 1;

I think I set something wrong in the environment setting, could you
please figure out why I have such error occur? many thanks!!!

I suspect you have a custom Config.pm in your @INC that is found before
the Perl Config.pm. Don't do that. But then, I am not a mindreader and
it is fairly difficult to correctly diagnose a problem without seeing
real code.

Sinan.
 
C

charlieskc

This is the complete script indeed. however I do have another script
called config.pm, but perl is case sensitive so I think it is different
from the Config.pm right?
 
S

Sherm Pendley

This is the complete script indeed. however I do have another script
called config.pm, but perl is case sensitive

Perl is case-sensitive, but the Windows file system is not.

If you do a 'use config' on a system with a case-insensitive file system,
then Config.pm will load and parse just fine. But, then Perl will look for
config->import(), and obviously it won't find it. So no functions or
constants get imported from the module.

sherm--
 
B

Brian McCauley

Sherm said:
Perl is case-sensitive, but the Windows file system is not.

If you do a 'use config' on a system with a case-insensitive file system,
then Config.pm will load and parse just fine. But, then Perl will look for
config->import(), and obviously it won't find it. So no functions or
constants get imported from the module.

True but this is not what is happening to the OP.

If you have your own module called config earlier in the @INC search
path then any module trying to load the standard Config module will fail.
 
S

Sherm Pendley

Brian said:
True but this is not what is happening to the OP.

The example file names were reversed - he's trying to load Config.pm and
getting config.pm instead, not the other way 'round - but otherwise that's
exactly what is happening.

The point is that the Windows file system is not case sensitive, whereas
package names are. Whichever way you look at it, it's that impedance
mismatch which is the cause of the problem.

sherm--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top