Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

PAR::pp with self created modules

by State_Space (Novice)
on Oct 31, 2015 at 01:39 UTC ( [id://1146547]=perlquestion: print w/replies, xml ) Need Help??

State_Space has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,
I'm using PAR::pp. I've read though the documentation.
PAR Tutorials
PAR FAQ
Honestly I don't understand a lot of it. I had a .pl that was 500 lines long and split it into 1 .pl and 3 .pms. The .pm's are in the local .pl folder .\lib. I use

 pp -gui -o name.exe name.pl

in perl console, it packs but it doesn't add the 3 .pms in the local \lib. I know the libraries don't get added because I unzip the packed package and they're not contained within.
From reading this Perlmonks post I solved the problem by moving the 3 .pm's to perl\site\lib. However the modules are very specialized and I want them close to the .pl for future editing. How can I add them to the package without moving them to perl\site\lib?
Below is the top of my .pl where I change @INC path for the local modules
#Modules use strict; use warnings; #Changing @INC to Self created modules use File::Basename qw(dirname); use Cwd qw(abs_path); use lib dirname(dirname abs_path $0) . '\name\lib'; #Self Modules use SA qw(extract); use CA qw(extract); use ECC qw(extract);

Replies are listed 'Best First'.
Re: PAR::pp with self-created modules (updated)
by Athanasius (Archbishop) on Oct 31, 2015 at 03:23 UTC

    Hello State_Space,

    I don’t understand what you’re doing in the .pl file. :-(

    However, to include .pm files in the packed package, use -I path/to/lib, followed by -M Module for each module to be included. For example, I used this command:

    13:12 >pp -o greet.exe -I C:/Users/User/Documents/Programmes/Perl/lib +-M Module1 -M Module2 -M Module3 1433_SoPW.pl 13:12 >

    When run from a directory containing the file 1433_SoPW.pl, and with suitable modules defined in lib/Module1.pm, lib/Module2.pm, and lib/Module3.pm, this successfully created a packed executable greet.exe with the 3 modules included.

    Update: Thanks, Anonymous Monk (below), a single -x is indeed better than multiple -M options:

    Hope that helps,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

      you run pp with -x if you want almost everything .pm to be found

      you use -M when -x fails (rare)

      Thank you for replying. It's exactly what I needed.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1146547]
Approved by Athanasius
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-23 09:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found