Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

pp and multiple perl scripts

by Dirk80 (Pilgrim)
on Mar 06, 2012 at 17:31 UTC ( [id://958125]=perlquestion: print w/replies, xml ) Need Help??

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

Hello wise monks,

I have written several command line perl scripts which I now want to call from a TK GUI. Because it are long jobs and I don't want to have a blocking GUI, I decided the following:

I have a main script which contains the TK GUI. This main script is then calling the other scripts by using inter process communication (fileevent functionality in TK) when the user presses a button. I call these other scripts helper scripts.

Of course I know with the help of you that it would be also possible to do this with threads when I'm very careful. But I think I prefer the way of IPC now. Is this design ok, or is it a bad idea to do it like this? What would be the alternatives?

But now to my main problem. Usually I pack my script with pp into a standalone executable to be able to deploy it. But now I want to pack not only my main script into a standalone executable, but also my helper scripts with all their dependencies.

Here my trials:

  1. pp -o standalone.exe main_script.pl helper_script1.pl

    Problem is here that it is not possible to call "standalone.exe" without an argument because it does not know what is the "main script".

  2. pp -a helper_script1.pl -o standalone.exe main_script.pl

    Problem is here that the dependencies of the "helper_script1.pl" are not packed into the "standalone.exe".

Then I tried it with "-M". This option usually checks the dependencies and adds them, but not if the suffix is ".pl".

What is a good way to solve this problem with pp?

Thank you a lot for your help!

Greetings,

Dirk

UPDATE:

SOLUTION is posted here: http://www.perlmonks.org/?node_id=959677

Replies are listed 'Best First'.
Re: pp and multiple perl scripts
by Anonymous Monk on Mar 06, 2012 at 18:06 UTC

      Thanks for your post. I'll give the cava packager a try.

      But fortunately I found a solution to this pp challenge myself.

      1. Create par consisting of main_script and its helper scripts with all their dependencies:

        pp -p -o perl_app.par main_script.pl helper_script1.pl helper_script2.pl
      2. Open perl_app.par with an archive program and add to the /script folder a main.pl file.

        main.pl:

        if (defined $ENV{PAR_APP_REUSE}) { warn "Executable was created without the --reusable option. See 'p +erldoc pp'.\n"; exit(1); } my $zip = $PAR::LibCache{$ENV{PAR_PROGNAME}} || Archive::Zip->new(__FI +LE__); my $member = eval { $zip->memberNamed('script/main_script.pl') } or die qq(main.pl: Can't open perl script "script/main_script. +pl": No such file or directory ($zip)); PAR::_run_member($member, 1);
      3. Create perl_app.exe as follows:

        pp -o perl_app.exe perl_app.par

      In the main_script you can then call the helper_scripts as follows (example with helper_script1.pl):

      my $cmd; if ( defined $ENV{PAR_TEMP} ) { $cmd = "perl $ENV{PAR_TEMP}/inc/script/helper_script1.pl"; } else { $cmd = "perl helper_script1.pl"; } # execute cmd
        Did you try that without an installed perl?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-19 11:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found