Re: help with "symbol lookup error" message
by Corion (Patriarch) on Jan 26, 2023 at 18:48 UTC
|
Maybe some module that File::Copy loads in turn tries to load List::Util.
Most likely, the root cause is you have mixed Perl versions and the modules below /home/user_foo/perl_modules were compiled for a different version of Perl / with a different C compiler / with different Configure settings than what you have now.
| [reply] [d/l] |
Re: help with "symbol lookup error" message
by syphilis (Archbishop) on Jan 27, 2023 at 01:38 UTC
|
The error references the List::Util module, but doesn't occur unless I add the "use File::Copy", ...
The odd thing there is that List::Util is being referenced, but I don't see how List::Util (which is quite separate from List::MoreUtils) gets loaded.
If your account of what's happening is accurate, then the only explanation I can think of is that, on your system, using File::Copy leads to the loading of List::Util (either by "use" or "require"), and the incompatible List::Util intalled in /home/user_foo/perl_modules/lib/perl5 is the one that gets found.
On my system, use File::Copy does not lead to List::Util being loaded - but File::Copy probably does some things differently on different systems.
If you want to check which modules have been loaded by your script (and where they were found), just add the following line at the end of your script:
for(keys %INC) { print "$_: $INC{$_}\n" };
If placed at the end of the script, that will not only tell you the modules that were loaded by "use", but also any modules that were subsequently loaded via "require" during the running of your script. (That's assuming, of course, that the script runs to completion ;-)
Cheers, Rob | [reply] [d/l] [select] |
|
#!/usr/bin/env perl
use strict;
use warnings;
BEGIN {
unshift @INC, sub { warn "Loading $_[1]\n"; 0; };
}
use File::Copy;
When I run this (with File::Copy 2.35 on perl 5.34.0 on Linux) the result is:
Loading File/Copy.pm
Loading File/Spec.pm
Loading File/Spec/Unix.pm
Loading Cwd.pm
Loading Exporter.pm
Loading XSLoader.pm
Loading constant.pm
Loading warnings/register.pm
Loading Config.pm
Loading Time/HiRes.pm
Loading Exporter/Heavy.pm
Loading Scalar/Util.pm
Loading List/Util.pm
Loading overload.pm
Loading overloading.pm
So List::Util is in there on my platform right enough.
* I'm sure there's a module for this but I can neither remember nor find it just now.
| [reply] [d/l] [select] |
|
So List::Util is in there on my platform right enough
Aaah ... cool.
AFAICS, this absurd dependency is not present in perl-5.36.0 - on both Windows and freebsd-12.0.
On Windows (perl-5.36.0), your script outputs:
Loading File/Copy.pm
Loading builtin.pm
Loading overload.pm
Loading overloading.pm
Loading warnings/register.pm
Loading File/Spec.pm
Loading File/Spec/Win32.pm
Loading Cwd.pm
Loading Exporter.pm
Loading XSLoader.pm
Loading File/Spec/Unix.pm
Loading constant.pm
Loading Config.pm
Loading Time/HiRes.pm
Loading Carp.pm
On freebsd (5.36.0), it's exactly the same - except that Carp.pm and File/Spec/Win32.pm are not loaded, and Exporter/Heavy.pm is loaded.
I'm sure there's a module for this but I can neither remember nor find it just now
I reckon the code you posted is much clearer for not having loaded that module (whatever it is ;-)
Cheers, Rob
| [reply] [d/l] |
|
|
|
|
unshift @INC, sub { warn "Loading $_[1]\n"; 0; };
It looks like it's creating an array of subroutines, where each subroutine just prints the same element (1). The 0 I'm guessing is just a required return value? I must be missing something here.
| [reply] [d/l] |
|
|
|
|
| [reply] |
|
|
|
|
|
#!/usr/bin/perl
use strict;
use warnings;
BEGIN {
unshift @INC, sub {
warn "Loading $_[1]\n";
push @ARGV, $_[1]
}
}
use File::Copy;
print "$^V\n";
print "$_\n" for sort {lc $a cmp lc $b} @ARGV;
__END__
v5.18.2
Config.pm
Exporter.pm
File/Copy.pm
File/Spec.pm
File/Spec/Unix.pm
List/Util.pm
overload.pm
overloading.pm
Scalar/Util.pm
vars.pm
warnings/register.pm
XSLoader.pm
> constant.pm
> DynaLoader.pm
v5.20.3
Config.pm
constant.pm
DynaLoader.pm
Exporter.pm
File/Copy.pm
File/Spec.pm
File/Spec/Unix.pm
List/Util.pm
overload.pm
overloading.pm
Scalar/Util.pm
vars.pm
warnings/register.pm
XSLoader.pm
< DynaLoader.pm
> Cwd.pm
v5.26.2
Config.pm
constant.pm
Cwd.pm
Exporter.pm
File/Copy.pm
File/Spec.pm
File/Spec/Unix.pm
List/Util.pm
overload.pm
overloading.pm
Scalar/Util.pm
vars.pm
warnings/register.pm
XSLoader.pm
< vars.pm
> Exporter/Heavy.pm
> Time/HiRes.pm
v5.28.0
Config.pm
constant.pm
Cwd.pm
Exporter.pm
Exporter/Heavy.pm
File/Copy.pm
File/Spec.pm
File/Spec/Unix.pm
List/Util.pm
overload.pm
overloading.pm
Scalar/Util.pm
Time/HiRes.pm
warnings/register.pm
XSLoader.pm
< List/Util.pm
< Scalar/Util.pm
> builtin.pm
v5.36.0
builtin.pm
Config.pm
constant.pm
Cwd.pm
Exporter.pm
Exporter/Heavy.pm
File/Copy.pm
File/Spec.pm
File/Spec/Unix.pm
overload.pm
overloading.pm
Time/HiRes.pm
warnings/register.pm
XSLoader.pm
| [reply] [d/l] |
|
| [reply] |
|
|
perl -MFile::copy -de0
DB<1> M
'Carp.pm' => '1.50 from C:/Strawberry/perl/lib/Carp.pm'
'Config.pm' => '5.032001 from C:/Strawberry/perl/lib/Config.pm'
'Config_git.pl' => 'C:/Strawberry/perl/lib/Config_git.pl'
'Config_heavy.pl' => 'C:/Strawberry/perl/lib/Config_heavy.pl'
'Cwd.pm' => '3.78 from C:/Strawberry/perl/lib/Cwd.pm'
'DynaLoader.pm' => '1.47_01 from C:/Strawberry/perl/lib/DynaLoader.pm'
'Exporter.pm' => '5.74 from C:/Strawberry/perl/lib/Exporter.pm'
'File/Spec.pm' => '3.78 from C:/Strawberry/perl/lib/File/Spec.pm'
'File/Spec/Unix.pm' => '3.78 from C:/Strawberry/perl/lib/File/Spec/Uni
+x.pm'
'File/Spec/Win32.pm' => '3.79 from C:/Strawberry/perl/lib/File/Spec/Wi
+n32.pm'
'File/copy.pm' => 'C:/Strawberry/perl/lib/File/copy.pm'
'IO.pm' => '1.45 from C:/Strawberry/perl/lib/IO.pm'
'IO/Handle.pm' => '1.45 from C:/Strawberry/perl/lib/IO/Handle.pm'
'List/Util.pm' => '1.55 from C:/Strawberry/perl/lib/List/Util.pm'
'Scalar/Util.pm' => '1.55 from C:/Strawberry/perl/lib/Scalar/Util.pm'
'SelectSaver.pm' => '1.02 from C:/Strawberry/perl/lib/SelectSaver.pm'
'SelfLoader.pm' => '1.26 from C:/Strawberry/perl/lib/SelfLoader.pm'
'Symbol.pm' => '1.08 from C:/Strawberry/perl/lib/Symbol.pm'
'Term/Cap.pm' => '1.17 from C:/Strawberry/perl/lib/Term/Cap.pm'
'Term/ReadKey.pm' => '2.38 from C:/Strawberry/perl/vendor/lib/Term/Rea
+dKey.pm'
'Term/ReadLine.pm' => '1.17 from C:/Strawberry/perl/lib/Term/ReadLine.
+pm'
'Term/ReadLine/Perl.pm' => '1.0303 from C:/Strawberry/perl/vendor/lib/
+Term/ReadLine/Perl.pm'
'Term/ReadLine/readline.pm' => '1.0303 from C:/Strawberry/perl/vendor/
+lib/Term/ReadLine/readline.pm'
'Time/HiRes.pm' => '1.9764 from C:/Strawberry/perl/lib/Time/HiRes.pm'
'Win32.pm' => '0.54 from C:/Strawberry/perl/lib/Win32.pm'
'XSLoader.pm' => '0.30 from C:/Strawberry/perl/lib/XSLoader.pm'
'constant.pm' => '1.33 from C:/Strawberry/perl/lib/constant.pm'
'feature.pm' => '1.58 from C:/Strawberry/perl/lib/feature.pm'
'overload.pm' => '1.31 from C:/Strawberry/perl/lib/overload.pm'
'overloading.pm' => '0.02 from C:/Strawberry/perl/lib/overloading.pm'
'perl5db.pl' => '1.57 from C:/Strawberry/perl/lib/perl5db.pl'
'strict.pm' => '1.11 from C:/Strawberry/perl/lib/strict.pm'
'vars.pm' => '1.05 from C:/Strawberry/perl/lib/vars.pm'
'warnings.pm' => '1.47 from C:/Strawberry/perl/lib/warnings.pm'
'warnings/register.pm' => '1.04 from C:/Strawberry/perl/lib/warnings/r
+egister.pm'
I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
| [reply] [d/l] |
Re: help with "symbol lookup error" message
by LanX (Saint) on Jan 26, 2023 at 19:47 UTC
|
that's a continuation of
,right?
| [reply] |
|
| [reply] |