0

Perl version is 5.26.1 Background : We have migrated our machines recently from SLES11 to SLES12.

Error : Can't export symbol: at File/Slurp.pm line 10.

The issue happens randomly and only for one specific file which we are reading. The same script is working for other files. The script which is using the File/Slurp module is working for all cases when we tried running it against multiple files.

Current issue is that in my module, the error occurs at the point where File/Slurp module is included at the beginning of the file.

use File::Slurp;

Line 10 of File::Slurp is --> use Fcntl qw( :DEFAULT ) ;

I tried running with debug options and prints but it doesnt seem to help me in figuring out the problem and check the CPAN documentation but couldnt find any information which would be of help to proceed further on this problem.

Can anyone suggest or give pointers on how i can proceed on this.

The issue is very random. like 1 time out of 10 runs it gives the error.

Perl CPAN module Slurp content

package File::Slurp;

use 5.6.2 ;
use strict;
use warnings ;
use Carp ;
use Exporter ;
use Fcntl qw( :DEFAULT ) ;
pupil
  • 185
  • 9
  • 1
    Can you provide a [mre]? Also, what does line 10 in your `File/Slurp.pm` say? Is it `use Exporter qw(import);`? – Ted Lyngmo Jul 12 '21 at 10:39
  • i have been trying to reproduce the issue but it doesnt seem to be working with an example i created. This is the reason for asking pointers. I create a simple example of passing a file as an input to a sample Perl script and the only line i added was the use File::Slurp to see if i could reproduce but it doesnt work. – pupil Jul 12 '21 at 10:55
  • Did you reinstall all the Perl libraries after upgrading Perl with the OS? – choroba Jul 12 '21 at 10:56
  • The perl libraries are in a central location. So no reinstall was needed – pupil Jul 12 '21 at 10:56
  • What does the `Slurp.pm` line(s) containing `$VERSION` say? – Ted Lyngmo Jul 12 '21 at 10:58
  • "_The issue is very random. like 1 time out of 10 runs it gives the error._" - Does that happen even if you feed the script exactly the same data? – Ted Lyngmo Jul 12 '21 at 10:59
  • package File::Slurp; use 5.6.2 ; use strict; use warnings ; use Carp ; use Exporter ; use Fcntl qw( :DEFAULT ) ; – pupil Jul 12 '21 at 11:01
  • There is no $VERSION. looks like we are using a pretty old copy of File::Slurp package. Hmmmm..thank you Ted ..let me try using a new version of this package. Hope this helps. – pupil Jul 12 '21 at 11:08
  • @pupil Yes, I'd reinstall perl and use the versions of the packages that comes with the distribution. – Ted Lyngmo Jul 12 '21 at 11:11
  • 1
    Will give it a try. Thank you – pupil Jul 12 '21 at 11:12
  • 2
    Are you sure you really need this module? There is a serious WARNING that recommends not to use it: https://metacpan.org/pod/File::Slurp#WARNING-PENDING-DOOM – Miguel Prz Jul 12 '21 at 18:15
  • 2
    File::Slurper or Path::Tiny are better choices. – Shawn Jul 12 '21 at 20:23
  • Good to know. Will check. thank you – pupil Jul 13 '21 at 08:05

0 Answers0