Search code examples
perlepic

Perl on Eclipse (EPIC plugin) vs standalone: Global symbol "%Config" requires explicit package name


I have a large project requiring maintenance. If I run the file on cmd, it works fine

perl entry.pl

However if I run with Eclipse (using EPIC plugin for Perl), it throws the following error

Global symbol "%Config" requires explicit package name at C:/Perl64/lib/Errno.pm line 11

I noticed the project includes a file called config.pm. Notice that 'c' is lower case in config.pm, but upper case in "%Config". I thought perl was case sensitive. I guess one solution would be renaming config.pm and all its references to something else (as suggested in Perl installation broken).

Is there a way to fix this other than renaming all references to config.pm ?

Why does it work when run on cmd, but not on Eclipse?


Solution

  • Since I resolved this issue. I thought I would answer, so that it can help somebody else.

    On Eclipse for some reason, having a config.pm 'collided' with the perl built in Config.pm, although the 'c's are different cases. If config.pm is part of a large project, renaming all references to the class config to something else is extremely difficult. The easiest is to move config.pm to a new directory (say MyMod) and have

    package MyMod::config;
    

    in config.pm

    With this , I only need to change use config to

    use MyMod::config;
    

    This solution works on both EPIC and outside (on command line)