Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Packaging for Perl Code

by tarunmudgal4u (Sexton)
on Sep 23, 2013 at 13:08 UTC ( #1055283=perlquestion: print w/ replies, xml ) Need Help??
tarunmudgal4u has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I've written a Perl script that I want to deploy on multiple clients. For this, to avoid Perl and required modules installation on clients, I thought to create a standalone exe of my Perl code.

I tried three different ways to accomplish this task i.e. 1) perl2exe 2) ActivePerl's perlapp and 3) PAR::Packer pp utility

All of these ways didn't work and the problem was with Sys::Info::OS module. No any of above utilities helped me to resolve this issue. Below is the somewhat error I got for all of these utilities (as of now it's the output of pp utility)-

Operating system identified as: 'Windows'. Native driver can not be lo +aded: Error loading Sys::Info::Driver::Windows::OS : Can't locate Sys\Info\Driver\Windows\OS.pm in @INC (@INC contains: C +ODE(0x2fccd0c) C:\Users\ADMINI~1\AppData\Local\Tem p\2\par-41646d696e6973747261746f72\cache-da79bd4ee6c09b5134fa9a2cc4755 +4c99da6eb1c\inc\lib C:\Users\ADMINI~1\AppData\Loca l\Temp\2\par-41646d696e6973747261746f72\cache-da79bd4ee6c09b5134fa9a2c +c47554c99da6eb1c\inc CODE(0x2d5adf4) CODE(0x2d5b18 4)) at Sys/Info/Base.pm line 46. at Sys/Info/OS.pm line 11. . Falling back to compatibility mode Error loading Sys::Info::Driver::Unknown::OS: Can't locate Sys\Info\Dr +iver\Unknown\OS.pm in @INC (@INC contains: CODE(0x 2fccd0c) C:\Users\ADMINI~1\AppData\Local\Temp\2\par-41646d696e69737472 +61746f72\cache-da79bd4ee6c09b5134fa9a2cc47554c99da 6eb1c\inc\lib C:\Users\ADMINI~1\AppData\Local\Temp\2\par-41646d696e697 +3747261746f72\cache-da79bd4ee6c09b5134fa9a2cc47554 c99da6eb1c\inc CODE(0x2d5adf4) CODE(0x2d5b184)) at Sys/Info/Base.pm li +ne 46. at Sys/Info/OS.pm line 11. BEGIN failed--compilation aborted at Sys/Info/OS.pm line 11. Compilation failed in require at script/TCExecutor.pl line 25. BEGIN failed--compilation aborted at script/TCExecutor.pl line 25.

Other details:

- OS: Windows Server 2008 R2 Standard (x64 bit)

- ActivePerl: (v5.16.3) built for MSWin32-x86-multi-thread

- This script runs normally if run using without packaging

Please let me know if you guys have faced this issue OR any suggestions will also be appreciated.

Comment on Packaging for Perl Code
Download Code
Re: Packaging for Perl Code
by marto (Chancellor) on Sep 23, 2013 at 13:21 UTC

    "as of now it's the output of pp utility"

    It'd make more sense if you actually showed how you ran pp to generate this executable. I suggest using the -x option and being verbose with the output of the packaging:

    pp -x -vv -o derp.exe derp.pl

      Below is the complete output-

      C:\Jenkins Workspace>pp -o TCExecutor.exe -l "C:\Perl\site\lib\Sys\Inf +o\Driver\Windows" -l "C:\Perl\site\lib\Sys\Info\Dr iver\Unknown" -l "C:\Perl\site\lib\auto\Sys\Info\Driver\Windows\Window +s.dll" -l "C:\Perl\site\lib\Sys\Info" -M "Sys\Info \Driver\Windows\OS.pm" -M "Sys\Info\Driver\Unknown\OS.pm" -M "Sys\Info +.pm" -M "Module\ScanDeps\DataFeed.pm" -x -vv TCEx ecutor.pl Set up gcc environment - 3.4.5 (mingw-vista special r3) C:\Perl\site\bin/pp: Packing TCExecutor.pl C:\Perl\site\bin/pp: Writing PAR on \ppLopua.par Killing running processes of IEDriverServer, chromedriver, firefox or +AutoItX3 if any.. No any IEDriverServer, chromedriver, firefox or AutoItX3 processes run +ning.. Looks Good Deleting C:\Users\ADMINI~1\AppData\Local\Temp\2 directory.. + done Mapping a drive to build machine 10.211.32.254.. failed Error: Couldn't map to network drive \\10.211.32.254\C$\luauser_perfor +ce\depot\Shared_Tech\Documentation\Projects\LUA\2. 3.3\QA\Automation\LUA Maven\Eclipse_Maven\Framework Please check your network: Sys\Info\Driver\Windows\OS.pm: No such file or directory at C:/Perl/si +te/lib/Module/ScanDeps/DataFeed.pm line 17. END failed--call queue aborted at TCExecutor.pl line 128. SYSTEM ERROR in executing TCExecutor.pl: 512 at C:/Perl/site/lib/Modul +e/ScanDeps.pm line 1302.

      I've implemented the changes suggested. Still, pp doesn't execute successfully.

        Hi, I've made some more changes and it's working fine now.. thanks

Re: Packaging for Perl Code
by tobyink (Abbot) on Sep 23, 2013 at 14:26 UTC

    Sys::Info::OS seems to load additional OS-specific modules at runtime. pp is not able to detect that it needs these when you're packaging, so you need to list them explicitly (-M option).

    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name

      And in the case of ActiveState PerlApp, --add "SomeThing::Foo".

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1055283]
Front-paged by Corion
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: (3)
As of 2014-11-01 13:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    If a safe, affordable anti-ageing treatment that extended life indefinitely were to become available, would you take it?



    Results (4 votes), past polls