Home > front end >  Perl in Intellij IDEA: Global symbol "%Config" requires explicit package name (did you for
Perl in Intellij IDEA: Global symbol "%Config" requires explicit package name (did you for

Time:01-13

I'm developing a large perl module which works like a charm when running from Terminal. When running i with Intellij IDEA CE, the following error pops up. This happens in all major versions of the software.

My programm starts:

#!/usr/bin/env perl

use strict;
use warnings;
use utf8;
use feature qw (say);

use Getopt::Long;

use lib 'lib';
die('this is a test');
...

Perls own lib.pm starts like this

package lib;

# THIS FILE IS AUTOMATICALLY GENERATED FROM lib_pm.PL.
# ANY CHANGES TO THIS FILE WILL BE OVERWRITTEN BY THE NEXT PERL BUILD.

use Config;

use strict;

my $archname         = $Config{archname};
my $version          = $Config{version};
my @inc_version_list = reverse split / /, $Config{inc_version_list};

our @ORIG_INC = @INC;   # take a handy copy of 'original' value
our $VERSION = '0.65';
...

In Intellij IDEA this leads to

/usr/bin/perl -I/home/user/git/mytool/lib -I/home/user/git/mytool/lib/Download /home/user/git/mytool/download.pl Digi20
Global symbol "%Config" requires explicit package name (did you forget to declare "my %Config"?) at /usr/lib/x86_64-linux-gnu/perl-base/lib.pm line 10.
Global symbol "%Config" requires explicit package name (did you forget to declare "my %Config"?) at /usr/lib/x86_64-linux-gnu/perl-base/lib.pm line 11.
Global symbol "%Config" requires explicit package name (did you forget to declare "my %Config"?) at /usr/lib/x86_64-linux-gnu/perl-base/lib.pm line 12.
Compilation failed in require at /home/user/git/mytool/download.pl line 10.

I don't know where these -I params to the perl executable are configured. In the run dialog, i configured no params for perl.

Ubuntu 22.04 LTA Perl 5.34. On my home office machine everything works fine, too. But on the office machine not. Syncing IDE settings home > office does not help.

Found another user having a Intellij Perl library settings dialog

There is a similar setting in the project structure settings but this does not cause -I parameters being added.

  • Related