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

Hi Monks, This is my 1st time converting a pl file to exe. My pl script uses both XML::Twig and XML::Simple. Script runs perfectly when run as a pl file. I used PAR::Packer to convert it to an exe using
pp -o test2.exe exp.pl
I get the following error when I run the exe Can't locate XML/SAX/Expat.pm in @INC (@INC contains C:\Users\XXX\JUNK CODE(0x277843c) CODE(0x27788cc)) at (eval 33) line 1.) Based on some previous answers I tried to include this
pp -M XML::LibXML::SAX exp.pl
Now I get a new warning Can't locate object method "new" via package "XML::SAX::PurePerl" So I tried to include
pp -M XML::SAX::PurePerl exp.pl
My code does not even run. I had to reinstall padre and start over again. Any idea how to fix this issue? I am very new to perl and this is my first time converting a pl file to exe. I am using Perl 5.14.2. Any ideas? Thanks Monks!

Replies are listed 'Best First'.
Re: Converting pl to exe
by soonix (Chancellor) on Feb 17, 2016 at 14:31 UTC
Re: Converting pl to exe
by RonW (Parson) on Feb 17, 2016 at 19:30 UTC

    More on use of the -x option: By itself, -x tells pp to run the specified Perl program. No arguments are supplied. This is attempt detection of modules (and libraries) loaded at run time. Sometimes, without arguments, your program will not load all - or even any - additional modules and/or libraries. Your program might even exit with a non-zero status. To work around these problems, there is the --xargs option to supply arguments to you program so that it will run "normally".

Re: Converting pl to exe
by Anonymous Monk on Feb 17, 2016 at 14:34 UTC
    Use pp -x or pp -c with -l as needed and see any par question on perlmonks