On Tue, Jan 12, 2010 at 9:37 AM, Nele Kosog <k...@sevencs.com> wrote: > Since the Digest method is passed as string, I think Data::Serializer uses > "SHA-256" (that's the default and I don't pass a different parameter to > Data::Serializer). > ... > No, it doesn't work with -M Digest::SHA.
Referring to the side note in my last post (sorry didn't realize the consequences): par.pl doing eval { $Digest::SHA::VERSION }; totally screws Digest's attempt to autoload Digest::SHA. Snippet from Digest.pm, $class holds the name of the actual digester module that we want to use, in your case "Digest::SHA": no strict 'refs'; unless (exists ${"$class\::"}{"VERSION"}) { eval "require $class"; if ($@) { $err ||= $@; next; } } return $class->new(@args, @_); Since par.pl has already been run (from prelude code in the packed executable that is run before your actual script), the above test has the side effect of bringing the global variable $Digest::SHA::VERSION "to life" (as if you had said "package Digest::SHA; our $VERSION; ..."). That variable actually is stored in the strange hash %{"Digest::SHA::"} under the key "VERSION". Hence the exists() returns true and Digest skips "require Digest::SHA". So while pp option -M generally works for modules whose usage goes undetected by both static dynamic (option -x) analysis, in your case it causes pp to pack the module, but Digest simply fails to load it. The simplest workaround is for you to explicitly use Digest::SHA; somewhere in your script (and then you can forget about -M). Cheers, Roderich