Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

How PAR pp works?

by saintex (Scribe)
on Jun 21, 2010 at 16:00 UTC ( #845769=perlquestion: print w/replies, xml ) Need Help??
saintex has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,
I'm trying to understand how PAR works.
First of all, I'm expecting it creates an executable file, with all dependencies resolved, but it seems it isn't so.
So I tried to do a simple code, like this one, just to test how PAR works:
use strict; use warnings; use Switch; my $mode='network'; print "\n\n"; switch ($mode) { case ('alternative') { print 'alternative'; } case 'network' { print 'network'; } else { # local value or not specified print 'default'; } } print "\n\n";
And I'm trying to have an executable file, with all dependencies ("use switch") solved. I'm tring:
pp -o hello.exe hello.pl
But the switch is not in the executable libraries.
En fact I have:
Can't locate deprecate.pm in @INC (@INC contains: CODE(0x140 lf\IMPOST~1\Temp\par-wolf\cache-a6a07c4c8edef3f3831fbe053938 C:\DOCUME~1\wolf\IMPOST~1\Temp\par-wolf\cache-a6a07c4c8edef af3a550\inc CODE(0x124b304) CODE(0x124b604)) at if.pm line 1 BEGIN failed--compilation aborted at Switch.pm line 7. Compilation failed in require at script/ciao.pl line 3. BEGIN failed--compilation aborted at script/ciao.pl line 3.
I have also read the documentation and tried -B option, but without result.

How can I build an executable file with deprecate.pm (or switch.pm) builded in it?
Thank you

Replies are listed 'Best First'.
Re: How PAR pp works?
by almut (Canon) on Jun 21, 2010 at 16:21 UTC

    Newer versions of Switch.pm (as they come with 5.12.x) have a line

    use if $] >= 5.011, 'deprecate';

    which - due to the use if - apparently isn't considered a dependency of Switch by Module::ScanDeps (which is used under the hood by PAR).

    Try explicitly adding the module (pp -M deprecate ..., I think). — Or better yet, don't use Switch in the first place... :)

      I have also turned the switch in if, elsif, else, solving that problem...
      But the problem is not the switch but is how the modules are boundled in...
      because I have the same problem with NET::SMTP and similar...
      I will read the document below from Anonymous Monk, and then I will get back here...
        But the problem is not the switch but is how the modules are boundled in...

        Well, the thing is that on some occassions, Module::ScanDeps fails to detect dependencies.  Usually, the problem is with shared object files that XS modules have been linked against, but there are also other difficult cases like the one above you found with Switch.

        In that case, you just have to help pp by telling it (using the options -M, -l, -a) what else to include in the package (.pm / .so files, etc.) in addition to what Module::ScanDeps automatically figured out.  In case of doubt, try to deploy the package in an environment comparable to the target environment (i.e. without Perl/modules/libs installed) until it no longer complains about missing stuff...

Re: How PAR pp works?
by Anonymous Monk on Jun 21, 2010 at 16:47 UTC
      after some reading and some tests I'm pretty satisfied of pp tool.

      I converted my switch in an if/elsif series as advised.

      Then I added some modules with -M option
      (Net::SMTP:TLS and MIME::Lite).

      So I ran some test programs with some satisfaction.

      Now I plan to use Simple::XML to read a config.xml file.

      pp doesn't find SAX.pm, so I linked it with -M option, but I have still another error:

      Can't locate unicore/Heavy.pl in @INC

      I have tried to link Heavy.pl through -M option, but... nothing to do... The program is still searching Heavy.pm

      So I searched over the web (Googled) and I found that thread:
      https://rt.cpan.org/Public/Bug/Display.html?id=58093
      it seems related to my problem
      (I have too strawberry perl 5.12, etc.)
      but not understood much about it...

      Any suggestions?
      thank you!

      Update:
      It seems there is a patch for Module::ScanDeps...
      the problem is that I don't know how to install that patch...
      (I have to simply insert it in Module main folder, and the make, make test, make install?)
      Thank you for your help
        You can install the Module::ScanDeps using CPAN #1. Perl -MCPAN -e shell install Module::ScanDeps

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://845769]
Approved by almut
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2018-05-23 19:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?