in reply to MD5 Peculiarities

Are you always calling create_checksum() from an instance? If you are just calling this after exporting or calling it with My::Module::create_checksum("value") then it will return the checksum of undef (which happens to be d41d8cd98f00b204e9800998ecf8427e). Two ways to fix it are to create an instance and call it from that instance, call it as My::Module->create_checksum("value"), you can call it as create_checksum(undef,"value"), or you can remove the $self = shift; line.

Of course, you should also use warnings; to alert you when you get undef values.

UPDATE: Late night and I put strict for detecting undef values rather than warnings. DOH!

antirice    
The first rule of Perl club is - use Perl
The
ith rule of Perl club is - follow rule i - 1 for i > 1

Replies are listed 'Best First'.
strict and undefined values (was: Re: Re: MD5 Peculiarities)
by bart (Canon) on Jun 22, 2003 at 13:01 UTC
    Of course, you should also use strict; to alert you when you get undef values.
    strict doesn't warn for undef values. warnings does, for many circumstances (except when using an undefined value is perfectly fine, for example, in boolean context: undef is a perfectly fine false value) — or simply use the -w command line switch, for example in the shebang line:
    #!/usr/local/bin/perl -w