Acme-Win32-PEPM

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl extension Acme::Win32::PEPM.

0.02  Fri Oct  9 10:55:32 2015
    -Fixed, dont make mixed line ending packed .pm files when the original
     .pm has crlf
    -Fixed, the makefile errored out if module had more than 1 .pm file
    -Improved tests
    -Fixed, unsupported CCs weren't correctly rejected on CPANTesters

0.01  Tue Nov 25 01:09:09 2014
    - original version

lib/Win32/PEPM.pm  view on Meta::CPAN


#stolen from XSLoader, unneeded on Win32 fluff removed
sub load {
    #we only load the caller .pm, this is not negotiable
    my $module = (caller())[0];
    my $bootname = "boot_$module";
    $bootname =~ s/\W/_/g;
    my $file = shift;
    my $libref = DynaLoader::dl_load_file($file, 0) or do { 
        require Carp;
        Carp::croak("Can't load '$file' for module $module: " . DynaLoader::dl_error());
    };
    push(@DynaLoader::dl_librefs,$libref);  # record loaded object
    push(@DynaLoader::dl_modules, $module); # record loaded module

    my $boot_symbol_ref = DynaLoader::dl_find_symbol($libref, $bootname) or do {
        require Carp;
        Carp::croak("Can't find '$bootname' symbol in $file\n");
    };
  boot:
    my $xs = DynaLoader::dl_install_xsub("$module\::bootstrap", $boot_symbol_ref, $file);

lib/Win32/PEPM/Build.pm  view on Meta::CPAN

#MZ files are EXE officially, COM files are different with a
#different (non-existant) header, Windows doesnt care about the ext
#for sanity to indiciate this isn't a Win32 EXE
sub makeCOM {
my $file = shift;
my $text = read_file($file, binmode => ':raw' );
my $crlf = index($text, "\r") != -1;
my $nl = $crlf ? "\r\n" : "\n";
#note, this will break if __END__ is in a string
my $pos = index($text, '__END__');
#stop following error caused by no __END__
#Unrecognized character \x12; marked by <-- HERE after <-- HERE near column 1 at
#C:/perl/***.pm line 154.
$text .= $nl.'__END__'.$nl if $pos == -1;
$text = 'MZ' #DOS MAGIC
    .';' #make the magic not be a syntax error
    .$nl.'#!!!!WARNING do not edit this file!!!!'.$nl
    .' ' #space pad to the heredoc
        x (0x40 #DOS headers full length
        -length('MZ')
        -length(';')
        -length($nl.'#!!!!WARNING do not edit this file!!!!'.$nl)
        -length('<<e_lfanew;'.$nl) #heredoc to escape
        -4 #size of DWORD e_lfanew
        )
    .'<<e_lfanew;'.$nl #heredoc



( run in 0.263 second using v1.01-cache-2.11-cpan-65fba6d93b7 )