Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: PAR packaging

by tsee (Curate)
on Jun 21, 2006 at 09:49 UTC ( #556613=note: print w/ replies, xml ) Need Help??


in reply to PAR packaging

Hi,

I have constructed a simple test which does what you want but does not reproduce your problem:

Put this in t.pl:

#!/usr/bin/perl use strict; use warnings; use lib '.'; use PAR qw/t.par/; use MyModule; print "\nbar\n";

And put this in the subdirectory lib in the file MyModule.pm

package MyModule; print "foo"; 1;

Now run this command:

PERL5LIB=lib pp -o t.par -p -v t.pl -M MyModule

Explanation:

  • If you just execute t.pl before running the pp command, MyModule.pm will not be found because it is in the lib/ subdirectory.
  • If you run the pp command, it temporarily uses lib/ as a perl library directory so pp can find and package MyModule.pm. (That's the PERL5LIB=... part.)
  • It puts MyModule.pm into the t.par archive.
  • Subsequent execution of t.pl will use t.par as a PAR archive and load MyModule.pm from there.

Does this work for you? If not, please tell me what OS you are on, what version of PAR you are using and what version of perl you have. This was PAR 0.941, perl 5.8.7 on kubuntu/dapper/x86_64.

Finally a little explanation of your strace output. (I'm not an expert on strace, though.) The file 1ec196d6.pm is a filename-mangled version of one of the modules PAR uses internally. To find out which one it is, open it with an editor and look for the "package" declaration. Now, the fact that it is put into the 1/ subdirectory of the cwd() is most certainly a PAR bug. I will investigate that and appreciate any feedback.

Hope this helps,
Steffen


Comment on Re: PAR packaging
Select or Download Code
Re^2: PAR packaging
by rootcho (Pilgrim) on Jun 21, 2006 at 23:05 UTC
    ok...thank you very much, will try your suggestions and will post the results..
Re^2: PAR packaging
by rootcho (Pilgrim) on Jun 23, 2006 at 23:16 UTC
    hmm, now after i read more carefully what u wrote.. i don't want to do exacactly what u specify
    I want MyModule.pm and myscript.pl to be outside of the .PAR so that i can change them often. And i want to use the .PAR for all of the CPAN modules we use.
    'Cause we don't own the boxes were the scripts will be, it will be alot easier for use to deploy the scripts if common CPAN modules can be in a .par.
    Now on the script...just for this reason I first use :
    use FindBin qw($Bin); use lib $Bin . "lib"; use MyModule;
    and then :
    use PAR '/path/to/test.par';
    So that the script can find the module, outside the .par.
    But as I already said when I execute the script outside the .par, I'm getting this 100%-cpu usage on stat64() call.
    OK, i contunued my investigation to see exactly which is this 1ec196d6.pm module, after I checked the cache the file is the HTML::HeadParser module.
    Now the more interesting part ;) If i go into the .par, delete this module from archive and start myscript.pl runs w/o a problem

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2014-07-31 14:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (249 votes), past polls