The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Module::Crypt - Encrypt your Perl code and compile it into XS

SYNOPSIS

 use Module::Crypt;
 
 CryptModule(
    name => 'Foo::Bar',
    file => 'Bar.pm',
    install_base => '/path/to/lib'
 );

ABSTRACT

Module::Crypt encrypts your pure-Perl modules and then compiles them into a XS module. It lets you distribute binary versions without disclosing code, although please note that we should better call this an obfuscation, as Perl is still internally working with your original code. While this isn't 100% safe, it makes code retrival much harder than any other known Perl obfuscation method.

PUBLIC FUNCTIONS

CryptModule

This function does the actual encryption and compilation. It is supposed to be called from a Makefile-like script that you'll create inside your development directory. The 5 lines you see in the SYNAPSIS above are sufficient to build (and rebuild) the module.

name

This must contain the name of the module in package form (such as Foo::Bar). It's required.

file

This is not required in most cases, as Module::Crypt locates the module file using the module name, but it's safer to specify it expecially when you have a multilevel module (that is Foo::Bar instead of, say, simply Foo).

install_base

(Optional) This parameter contains the destination of the compiled modules. If not specified, it defaults to a directory named "output" inside the current working directory.

BUGS

  • Module::Crypt is currently only able to encrypt one module/file for each Perl run.

  • Exporter may not work (actually this is untested).

  • There could be some malloc() errors when encrypting long scripts. It should be very easy to fix this (the cause is bad way to calculate allocation needs).

  • The build backend is based on Module::Build, which is not very flexible and requires some bad workarounds to produce working modules. Module::Build should borrow C/XS related subroutines from its code, subclass or maybe switch to ExtUtils::CBuilder.

AVAILABILITY

Latest versions can be downloaded from CPAN. You are very welcome to write mail to the author (aar@cpan.org) with your contributions, comments, suggestions, bug reports or complaints.

AUTHOR

Alessandro Ranellucci <aar@cpan.org>

COPYRIGHT AND LICENSE

Copyright (c) 2005 Alessandro Ranellucci. All Rights Reserved. Module::Crypt is free software, you may redistribute it and/or modify it under the same terms as Perl itself.

DISCLAIMER

This is highly experimental code. Use it AT YOUR OWN RISK. This software is provided by the copyright holders and contributors ``as is'' and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the regents or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.