mohad
mohad

Reputation: 31

pl to exe using Par::Packer - How to use

I have a perl script which needs to be converted to a exe file. I saw that Par packer will help to achieve this. But I have no idea on how to install this Par packer and do the conversion. Can someone please guide me ? Any tutorial videos will help a lot.

here is the code:

 #!/usr/bin/perl
 use warnings;
 use strict;


for my $file (glob '*.mobi *.prc *.epub') {
my ($ext) = $file =~ /\.(.*)/;
if ($ext =~ /mobi|prc/i) {
    my $status = system qw{ kindletool.exe strip_source }, $file;
    warn "Failure $status: $file" if $status;

} elsif (lc $ext eq 'epub') {
    (my $newname = $file) =~ s/\.epub$/.zip/;
    rename $file, $newname or warn "Failure $!: $file";
}
}

Upvotes: 0

Views: 3413

Answers (1)

Dr.Avalanche
Dr.Avalanche

Reputation: 1996

pp -x -o outputexename yourscriptname.pl

This will generate outputexename.exe, specified by -o. The -x means that perl will run your code prior to packing to include any additional runtime dependancies (modules etc). See also PAR::FAQ

Edit

To install the module, from the command prompt run:

cpan pp

or if you have cpanm installed

cpanm pp

The bare minimum you should do for any tool you decide to use is read the documentation: https://metacpan.org/source/RSCHUPP/PAR-Packer-1.026/README

Upvotes: 1

Related Questions