in reply to "Cannot find location"

Thank you for your replies, I will answer here to all!

1- I am using Centos-7 (64 bits) with Webmin and Virtualmin panels.

2- I added BEGIN { push @INC, '/root/perl5/lib/perl5';} and it did not change anything, the same message is returned saying, it seems that this "push" is not considered.

3- Haukex, you told me to use Digest::MD5 instead of Digest::MD5::File. I do not understand, as Digest::MD5 is properly installed and works fine, but it does not include the functions I am using. Only Digest::MD5::File includes. If I remove the "::File" line I get this error when running the script:

Can't locate object method "addpath" via package "Digest::MD5"

Script section:
my $md5 = Digest::MD5->new;
$md5->addpath($longfile);
my $digest = $md5->hexdigest;
my $digest = file_md5_hex($longfile);
End of Script section

4- You tell me to install "correctly" the module. So my 2 questions are 1- How to UNinstall it (from the bad location) and 2- How to install it correctly, using CPAN or yum?


As you probably noticed I am really not an expert ;)

Thank you!

Replies are listed 'Best First'.
Re^2: "Cannot find location"
by haukex (Archbishop) on Apr 03, 2017 at 08:37 UTC
    Digest::MD5 ... does not include the functions I am using. ... If I remove the "::File" line I get this error...

    I didn't mean that Digest::MD5 is a drop-in replacement for Digest::MD5::File, sorry for the misunderstanding. You would need to use Digest::MD5 according to its documented API. (Digest::MD5::File appears to monkey-patch its functions into Digest::MD5, which probably just adds to the confusion.) For example, here's how you might replace the module's file_md5_hex function:

    use Digest::MD5; sub file_md5_hex { my $filename = shift; open my $fh, '<:raw', $filename or die "open $filename: $!"; my $md5 = Digest::MD5->new->addfile($fh); close $fh; return $md5->hexdigest; }