in reply to Re: packaging perl
in thread packaging perl

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.

Replies are listed 'Best First'.
Re^3: packaging perl
by jeffa (Bishop) on Jun 19, 2014 at 21:13 UTC

    "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)
    
Re^3: packaging perl
by dasgar (Priest) on Jun 19, 2014 at 21:14 UTC

    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

        % pp -I /foo hello          # Extra include paths

        ModuleA.pm does not look like an include path :)

        However, pp still manages to pack both ModuleA.pm and ModuleB.pm , even if moduleB.pm is packed as another script

        This is what is normally typed

        If for some reason . is not in @INC its
        $ pp -I . -x start.pl -o start

        My test files in the form of a patch (apply with patch -p0 -i my.patch )