Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: packaging perl

by dasgar (Curate)
on Jun 19, 2014 at 13:38 UTC ( #1090465=note: print w/replies, xml ) Need Help??

in reply to packaging perl

When using pp, I'm now in the habit of using the -c and -x options so that it can pick up on the needed modules. That should get pp to pick up your "other installed perl modules". If after that pp is still not picking up your .pm files, you can use the -I option to specify an additional path for pp to look in for modules and if you need to, you can use this option multiple times.

Although I personally haven't used this module myself, you could also use App::FatPacker to pack all of the modules that your script uses (including your .pm files) along with your script into one large .pl file. Then you can use pp to package that large .pl file into an executable.

Replies are listed 'Best First'.
Re^2: packaging perl
by Jocqui (Novice) on Jun 19, 2014 at 13:42 UTC

    have tried App::Fatpacker but due to the fact that the pm files are interliinked and arent referenced directly by pl it doesnt pick them up. i will try it with pp again and let you know, Thanks

Re^2: packaging perl
by Jocqui (Novice) on Jun 19, 2014 at 20:12 UTC

    Unfortunately cant seem to get pp to work .The pm packages are ones i have created for the purpose of reusing my code so for example if want to use a function between modules in perlmodulea i have to require perlmoduleb &perlmoduleb::function so using pp -I will package everything but when i exacute it i get Can't locate in @INC (@INC contains: /tmp/par-root/cache-e4edf49bbe31d9e1cba71594a8c68a0e6090d909/inc/lib /tmp/par-root/cache-e4edf49bbe31d9e1cba71594a8c68a0e6090d909/inc CODE(0x241dd30) CODE(0x241e1b0)) at script/ line 7.

      "I have a large perl project that i have split up into one main .pl file and multiple .pm files that are being referenced by the main .pl file . I wish to package everything into one file "

      When you say you split up the large project, this begs the question if the large project was one file to begin with. If so, why do you want to put the pieces back into one large file again?

      Why not instead do what CPAN authors do? A CPAN module is one TAR BALL. Then you use standard Perl tools to install that module. I recommend that you download Module::Starter and use it to build the skeleton framework that will house your custom Perl code and use something like Module::Build to install it.


      (the triplet paradiddle with high-hat)

      Can you provide the following information?

      • Names and full paths to the .pl script and .pm files that you wrote and are trying to use
      • The use and require statement lines from your .pl script.
      • The full command you're using to call pp (including all option arguments for pp).

      If you can provide this information, that could help others figure out what's happening and how to fix it.

        Here is an example of the code i am using in the

        #!/usr/bin/perl use strict; use warnings; use Time::HiRes qw(usleep); require moduleA; require moduleB; &moduleA::functionA(); &moduleB::functionA(); &moduleB::functionB(); __END__

        and the perl moduleA

        package moduleA; use strict; use warnings; require Expect; require Time::HiRes; require moduleB; use Time::HiRes qw(usleep); sub functionA() { my variableA ="&moduleB::functionB"; .............. ................ return someihng; }

        When using pp

        pp -I -o start

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1090465]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2017-03-27 23:50 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (325 votes). Check out past polls.