Converting Perl script to EXE using Par Packer in Perl - perl

I have converted an executable file using Perl Par Packer in Windows 7. But when I execute the file, it shows some error.
I think I have to add the module also, but I am not sure. I basically use pp -o sample.exe sample.pl
I use ActivePerl 5.16.
It's working fine as the Perl script, but after converting into an EXE file, it terminates with the error.

It seems that some required modules (ByteStreams.pm, Collection.pm, DOM.pm) are missing from your perl package.
Try to download and install them using ppm (perl package manager).
1. Press start Button , type perl
2. click on ppm logo
3. search module name from search box
4. Install.
If authorization failed try to install via command prompt.
open cmd.
type: ppm install 'module name'
rebuild your exe and run.

This issue is solved by adding the Mojo module in the same location of the standalone executing file

I like perl , and I also like C/C++. To make the best of both,
I wrote a github project to solve this issue.
please see:
https://github.com/tlqtangok/perlcpp
a short example is here :
P_eval("$a=2;$a=$a**10;");
Int("a") ; // a= 1024
P_eval("$a=qq(abc);
P_eval("#arr=(0..9);";
P_arr_Int_i("arr", 8 ); // => 8

Related

Perl package is installed but still see error

I have just installed the package in my system using the instructions described in the question "How to install .pm to run the perl script"
Now, I am trying to run the Perl script But I still see the following error:
Win32::OLE operating in debugging mode: _Unique => 1
at C:/Dwimperl/perl/site/lib/Win32/OLE/Lite.pm line 30
require Win32/OLE/Lite.pm called at C:/Dwimperl/perl/site/lib/Win32/OLE.pm line 48
require Win32/OLE.pm called at C:\Users\c_desaik\Desktop\pwrdb\offtarget\pwrdb.pl line 37
main::BEGIN() called at C:/Dwimperl/perl/site/lib/Win32/OLE/Lite.pm line 0
eval {...} called at C:/Dwimperl/perl/site/lib/Win32/OLE/Lite.pm line 0
main::(C:\Users\c_desaik\Desktop\pwrdb\offtarget\pwrdb.pl:53):
53: my $prod_id = "QPSTAtmnServer.Application";
DB<1>
I can actually see the OLE.PM file at the location C:/Dwimperl/perl/site/lib/Win32/OLE but still it is throwing an error.
I did not copy the module, I installed it using CPAN.
I am confused because there are two locations where I see an OLE folder
C:\strawberry\perl\site\lib
C:/Dwimperl/perl/site/lib/Win32/OLE
Normally, when I install something, it has only one root directory. I am not sure why Perl is operated from two of those.
"Win32::OLE operating in debugging mode" is not an error. It's a warning that's issued when a script using Win32::OLE is run from the debugger. Everything is functioning as it should.
It looks like you have both DWIM Perl and Strawberry Perl installed on the same Windows machine. Unless you need to use both simultaneously, then you should uninstall the one you aren't using.
To get things working again you may need to uninstall both versions of Perl and reinstall your preferred brand.

PAR installation in perl cannot be completed

I desperately need your help! I need to compile a perl script to an executable so that it can be run in windows without having perl installed. I know it is not a good idea to do this , but I absolutely need it for the users of my script.
I have searched (a lot!) and decided the best solution is to use PAR::Packer. Yet I have been trying to install for something like 10 days now with no success… 
I ve tried all possible combinations of perl installation (activestate, strawberry, 5.10, 5.14, 5.16) and PAR versions, but I haven’t found the combination that really works….
I tried this link: http://www.nicholassolutions.com/tutorials/perl-PAR.htm
And this: http://www.rabbibob.com/index.php/PAR_Compiling_Perl_scripts_into_executables#Can.27t_find_par_loader
And various from this site..
Anyway, right now, I have installed (with the above instructions):
Strawberry perl 5.16.3001
PAR-1.007
The error I get now when I try to run
pp –o script.exe script.pl
is that:
pp is not recognized as an external or internal command, operable program or batch file
indeed I don’t find the relevant pp.bat in the bin. For earlier versions of par, this bat was created, although there other missing files were appearing when
running pp….
My path variable contains:
C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin
I also used PAR::Packer 1.0.14 but I get errors in the installation, something like
dmake.EXE: Error code 255, while making 'subdirs'
So, my question is: does anyone know a sure way this can work?? I am really frustrated and really pressed, every help will be deeply appreciated.
Thanks a lot!
I have used PAR to pack some scripts for other users. This has worked very well.
My old setup was done long ago. I have a new laptop and I tried to reproduce you error - but it seems like it just works.
My steps:
downloaded and installed strawberry-perl-5.18.1.1-64bit.msi
Install PAR::Packer with the cpan client
Create a testscript and type
pp -c -o test.exe test.pl
This produce the file test.exe - and it works fine.
the executable file pp is located in C:\strawberry\perl\site\bin\pp and was installed when i installed PAR::Packer.
If you cant find pp on you system you might want to check you installation of PAR::Packer.
I hope this helps :)

making perl executables on windows

hi experts,
I want to make a executable from simple perl script in dir D:\script.pl (just prints hello world)
I want to do this using PAR::pp. I have installed it using cpanm PAR.
Could someone show actual steps. As i tried pp -o name.exe D:\script.pl both in cmd prompt and padre, but no success. Error : pp is not recognized as internal or external command . . .
Also there are some more questions, which I want to discuss, but want to clear above one first.
System info : Windows 7, 32 bit, PAR 1.007 , Strawberry perl 5 v14 sub ver2 v5.14.2. Padre IDE.
Does PAR archive mean a set up file?
pp doesn't actually come with PAR anymore, you must install the PAR::Packer distribution to get that.

How to compile sendxmpp perl script in Cygwin

I have been using telnet to issue test commands to my Jabberd2 server. It is a clunky method, so I downloaded the sendxmpp package included with my build of Cygwin. When I issue the command sendxmpp -h I get the following error(minus the #INC path dump): can't locate Authen/SASL.pm in #INC BEGIN failed--compilation aborted at /usr/bin/sendxmpp line 21.
I think the problem is ldap related, however I have installed all of the perl and ldap modules available.
Does anyone know how to fix this error?
Are there additional configuration steps needed to get ldap working
with perl in the Cygwin environment?
Is there a better way to issue xmpp commands to Jabberd from the
command line?
Looks like you're missing the Authen::SASL module. If it's not part of the sendxmpp package, try installing it with cpan -i Authen::SASL. If it IS available, make sure sendxmpp (which may very well be a perl script) finds it, by modifying the inc/lib directory. If Authen::SASL is supposed to be installed and available systemwide, try executing perl -MAuthen::SASL. If that triggers an error, perl can't find it. If it just "hangs" there (waiting for input), perl did find the module, and sendxmpp should work.

How to use a perl module?

I have installed PAR from CPAN. Now, how do you use it? It gives usage example as:
% pp -o hello hello.pl
How do you use this on Windows? pp gives "command not found".
I am new to perl. Only thing I need is to run a module.
pp isn't a module, it is an application. You need to figure out where it was installed to (I don't know which perl you are using or how you installed it) and use the full path to it.
You should look in your lib directory to ensure that the pp.pm file exists somewhere. then, you can load it up by typing use Par::pp; at the perl command line (i'm guessing that it is part of PAR based on what i've found, it could be something as simple as use pp; at the command line).
once the module is loaded, it should provide the pp command for you to use.
thanks,
mark