[H-GEN] Tracking down Perl compilation hassles (was: RT3 under Debian)

Jason Parker-Burlingham jasonp at uq.net.au
Wed Jun 4 00:31:55 EDT 2003


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

Greg Black <gjb at gbch.net> writes:

> On 2003-06-03, Jason Parker-Burlingham wrote:
>> (or around) line 53.  Exactly which module is RT3 expecting?  I would
>> certainly make sure that is installed rather than any alternative.
>> It's probably looking for Digest::Perl::MD5, but it's worth checking;
>
> Line 53 of /usr/share/perl5/RT/User_Overlay.pm is:
>     use Digest::MD5;
>
> So I guess making that visible as .../Digest/Perl/MD5.pm is
> going to provide the correct thing.  The question remains: why
> does it want it under that name when the "use" statement seems
> to be asking for something that should be found (based on the
> reported value of @INC) in /usr/lib/perl/5.8.0/Digest/MD5.pm
> without any additional effort?

Whew!  Good question!

The answer is in Digest::MD5.pm:

   package Digest::MD5;
   
[...]
   require DynaLoader;
   @ISA=qw(DynaLoader);

This means that Digest::MD5 inherits from DynaLoader.  It's probably
obvious what happens just by reading that, but it's fun to trace it
through:

   eval {
       Digest::MD5->bootstrap($VERSION);
   };

First it tries to call the C<bootstrap> class method (inherited from
DynaLoader.pm).  This is done in an C<eval> (note it's the safer and
faster "eval BLOCK" form, as opposed to the "eval STRING" form; think
of it as a try{} block).

   if ($@) {

$@ is set after the C<eval> if there was some sort of an error.

       my $olderr = $@;
       eval {
           # Try to load the pure perl version
           require Digest::Perl::MD5;

If bootstrapping Digest::MD5 fails, fall back to Digest::Perl::MD5.  I
suppose the latter exists to provide the hashing function for
installations that have no C compiler.
   
           Digest::Perl::MD5->import(qw(md5 md5_hex md5_base64));
           push(@ISA, "Digest::Perl::MD5");  # make OO interface work

If there's no error, Digest::Perl::MD5 is set up to behave like
Digest::MD5.

       };
       if ($@) {
           # restore the original error
           die $olderr;
       }

Otherwise everything craps out.

Fascinating, really.  Looks like you can install Digest::MD5 for speed
or Digest::Perl::MD5 for convenience.  I don't know why Digest::MD5
couldn't be loaded, since it exists already in @INC (you said in an
earlier message you said locate found Digest/MD5.pm in
/usr/lib/perl/5.8.0 and /usr/lib/perl5).  What happens if you run:

   $ perl -MDigest::MD5 -le'print Digest::MD5->VERSION'

If Digest::MD5 really is failing to load or bootstrap that should
indicate what the *real* cause of the problem is.

But hey, if stuff's working and you're happy, I'm not going to bother
you further.

Cheers,

jason
-- 
Stay up-to-date on what I'm doing lately:
                                 http://www.netacc.net/~burlingham

--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.  See http://www.humbug.org.au/



More information about the General mailing list