the_apprentice has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I've a little problem (I'm Perl super newbie). I installed the Digest::SHA1 module from CPAN.
sudo cpan -i Digest::SHA1
The module was installed in "/usr/local/lib64/perl5". Here a snippet of a test
#!/bin/env perl use warnings; use strict; use Digest::SHA1 "sha1_hex"; my $tmp = sha1_hex("hello"); print "SHA1 = " . $tmp . "\n";
First I got this error: Can't locate Digest/SHA1.pm in @INC.... I solved adding a new env variable export PERL5LIB="/usr/local/lib64/perl5"
$ perl -e 'print "$_\n" foreach @INC' /usr/local/lib64/perl5 /usr/local/lib/perl5/site_perl/5.18.1/x86_64-linux /usr/local/lib/perl5/site_perl/5.18.1 /usr/local/lib/perl5/5.18.1/x86_64-linux /usr/local/lib/perl5/5.18.1 .
Problem solved?? No... Here a new problem: Segmentation Fault What is wrong now? (I'm sorry for my bad english :D)

Replies are listed 'Best First'.
Re: SegFault after installed module
by Athanasius (Archbishop) on Dec 02, 2013 at 15:38 UTC

    Hello the_apprentice, and welcome to the Monastery!

    Bug #81102 for Digest::SHA1 says:

    could you please cut a release which advises to use the Digest::SHA module for SHA1 since it is part of core, so new modules don't use this, and there's less confusion for authors of which module to use.

    So it seems you would be better-off using the Digest::SHA core module, which you already have as part of your existing Perl installation.

    (I can’t comment further as I don’t have a 64-bit OS.)

    Hope that helps,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Re: SegFault after installed module
by karlgoethebier (Abbot) on Dec 02, 2013 at 15:44 UTC

    Athanasius was faster :-( But to complete this - the note from the manual:

    In 2005, security flaws were identified in SHA-1, namely that a possible mathematical weakness might exist, indicating that a stronger hash function would be desirable. The Digest::SHA module implements the stronger algorithms in the SHA family.

    Please see also SHA-1.

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

Re: SegFault after installed module
by the_apprentice (Novice) on Dec 02, 2013 at 17:30 UTC
    Thank you both... now it work...
      "...now it work."

      That's nice. But what did you do? It's good practice to report the reason for your success - but XPs are not guaranteed for this effort ;-(

      Best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

        You're right.. I changed my code as suggested above in:
        use Digest::SHA "sha1_hex"; my $var = sha1_hex("Thank you Monks!!!");