http://qs321.pair.com?node_id=11137612


in reply to PAR::Packer shebang + PAR::Heavy missing

Re-reading this I think I see what you are trying to do now (although not the full context). We probably need to see some code to show how you are setting things up.

For #1, there is no standard shebang. It is maybe clearer to call the script using the perl script.pl idiom as then you can be more sure of which perl is used. It's what I tend to do, but others will have different views.

For #2, PAR::Heavy is part of the PAR distribution. You should not need it in your script unless you are trying to use PAR archives packed using PAR::Packer. And even then it is simpler to just pack the whole script into a stand-alone exe and have the user call that. This is also one of the points raised by Marshall in 11137280.

What to do depends on details we have not been given but I'll list some possible options.

If you are distributing scripts for users to call then use pp on each system to pack self-contained executables. Then you don't need to worry about what version of perl is on each system, which version is in use at the time, or what non-core libraries are installed. If you have many scripts then it's easy enough to write a build script to pack a series of such files.

(This is more complex, probably more so than is necessary). If you are using a single master script to call others then you can pack each script as an executable or a PAR file, pack these with the master script (see the --addfile option for pp), and then have logic in your script that calls PAR files when it is run under PAR by testing for $ENV{PAR_0}. It can also conditionally require any PAR libraries in that case so non-PAR systems do not need them (e.g. something like use if $ENV{PAR_0} PAR). If $ENV{PAR_0} is false then call any scripts directly. An issue with this approach is that it requires duplication of any calling logic as there are now two ways of calling each file.

And just to note, files packed using pp --addfile ... can be found under $ENV{PAR_TEMP}/inc.