Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: packaging perl

by dasgar (Deacon)
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.


Comment on Re: packaging perl
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 modulea.pm in @INC (@INC contains: /tmp/par-root/cache-e4edf49bbe31d9e1cba71594a8c68a0e6090d909/inc/lib /tmp/par-root/cache-e4edf49bbe31d9e1cba71594a8c68a0e6090d909/inc CODE(0x241dd30) CODE(0x241e1b0)) at script/test.pl 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.

      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      B--B--B--B--B--B--B--B--
      H---H---H---H---H---H---
      (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 start.pl

        #!/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 start.pl -I ModuleA.pm ModuleB.pm -o start

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1090465]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2014-12-29 01:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (183 votes), past polls