On Mon, Dec 5, 2011 at 3:23 AM, Gary Yang <garyya...@yahoo.com> wrote:
> I use the command, "pp -f Crypto -F Crypto -M Filter::Crypto::Decrypt -o 
> testPP testPP.pl" to  encrypt the script.

First of all, encrypting the script is a red herring, it has nothing
to do with the problem.

> But, I got 'Unknown PerlIO layer "encoding"' when I run the script. I guessed 
> the line, binmode STDOUT, ":encoding(UTF-8)"; might cause the problem.

Correct. Module::ScanDeps analyzes your script for dependencies and
indeed it has
a rule ro recognize the pattern ":encoding(FOO)". But then it
outsmarts itself and tries
to determine which module would actually be required for encoding "FOO" (so that
it could just pack in that module). Two problems here:
- it overlooks that the machinery to find this module (i.e. Encode.pm)
is also needed
  at script runtime, so at least Encode.pm would have to be packed in any case
- it relies on knowledge about the internals of Encode.pm (which might change)

As a workaround, add "use Encode;" to your script.

I filed RT #72954 to track the actual problem.

Cheers, Roderich

Reply via email to