++ed by:
Author image Daniel Dragan


Acme::Win32::PEPM - turn your separate XS .dll+.pm into being both a .pm and .dll


  #in your Makefile.PL
  use Win32::PEPM::Build;
  my %config = {
    NAME              => 'Foo::Bar',
    AUTHOR            => 'A. U. Thor <a.u.thor@a.galaxy.far.far.away>',

  #in your .pm
  use Win32::PEPM;
  Win32::PEPM::load(__FILE__, $VERSION);
  __END__ #you must have this
  #optional, suggested if you have pod.t
  =encoding latin1


This module is a packager that allows you to build a .pm that is simultaneously a .pm that can be do, required, or used, and the same .pm is a 100% real DLL containing XS code. The generated file meets the file format standards of both a .pm and a PE (Portable Executable) DLL and uses no temp files. The author of this module sees this module as a joke since with this "packager", the .pm text is stored uncompressed in the .dll, and there is no sane reason to keep .pm text memory mapped into a process since after parsing/compiling .pm, the .pm text is never referenced again, yet with this "packager", if the XS DLL is loaded, so is the .pm text, into the process.

The resulting .pm that is built can not be edited even though it mostly looks like plain text. If it is edited, the DLL will be corrupt. The resulting .pm, although superficially looking like pure perl can not be moved between perl installations/versions except for maint versions, since the XS DLL inside the .pm, like all XS DLLs/SOs is bound to a particular perl installation and version number.



    Win32::PEPM::load(__FILE__, $VERSION);

Similar to XSLoader load sub except takes a filename as first arg. This file name must be the __FILE__ token.


  • Mingw/GCC support not implemented. Patches welcome. The author has no clue what VC's -stub is with ld.


Daniel Dragan, <bulkdd@cpan.org>


Copyright (C) 2014 by Daniel Dragan, <bulkdd@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.21.6 or, at your option, any later version of Perl 5 you may have available.