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

I have a perl application that sends a XMLRPC request to a server, and in return, expects a token generated by the server. The problem lies in that the application behaves differently when it was still a perl program (.pl) VS. after it was converted to an executable (.exe) Here is where the problem is, the perl app xmlrpc_test.pl sends my login info as follows
use XML::RPC; .... my $server = "https://...."; my $xmlrpc = XML::RPC->new($server); my $user = "userid"; my $password = "password"; my @args = ($user, $password); my $token = $xmlrpc->call("login", \@args); ....
And if I were to run this perl app directly, I get a token without a problem. But if after I tried packing it with PP (i'm calling wxpar here because the front GUI is done with Wx):
wxpar -M XML::TreePP -M LWP::UserAgent -M HTTP::Lite -o xmlrpc_test.ex +e xmlrpc_test.pl
From commandline I get the following output:
no data at XML/RPC.pm line 255
And the .exe exits/crashes. From what I find out, XML::RPC call function returned a null in the $response variable, which is what caused the error. Did I miss including a package via the -M fields? The PP ran without any problems and the .exe was successfully generated. Everything runs well except when it comes to send the XMLRPC request... The most puzzling is why it works in .pl form and not in .exe form... Any help is appreciated!

Replies are listed 'Best First'.
Re: Perl PP/PAR packaged executable can't send XML::RPC requests
by Anonymous Monk on Jul 14, 2014 at 20:28 UTC

      The thing is my .exe actually runs successfully and WX GUI interface opens without any problems, so I don't think it's a windows DLL issue.

      It is only when I try to do a XML::RPC call, do I get the "no data" error, which I think is due my program (acting as a XML-RPC client) not getting a proper response from my remote XML-RPC server.

      So I think the real problem is understanding why the .pl works (gets response from server) while the exact same program in .exe doesn't...

      I ran depends.exe anyways just to see what I get, I did get these files reported missing:

      API-MS-WIN-CORE-COM-L1-1-0.DLL API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL API-MS-WIN-CORE-WINRT-L1-1-0.DLL API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL API-MS-WIN-SHCORE-SCALING-L1-1-0.DLL DCOMP.DLL IESHIMS.DLL
      However I don't think this is a problem. As mentioned before, the program opens and runs properly with the GUI displayed and 99% of the features working, except the XML-RPC thing.

      All dependencies (-M) should be good as well.

      Help...

      Edit: Oh and btw, if I try to compile the .exe using ActiveStates PDK, the problem actually disappears (XML-RPC response is properly received). But PDK is not free and the trail only last for a few weeks..

        I'm not familiar with wxpar, but from its documentation, I see the following:

        run 'wxpar' exactly as you would run pp.

        From what you posted, you're not using the -c or -x options. If you look at the documentation for pp, the -c and -x options are used to "determine additonal run-time dependencies". Since you're not using either of these options, it's possible that wxpar is not picking up some needed dependencies for the XML::RPC that is causing the very issue that you are seeing.

        Also, if you use the -c and/or -x option to catch any missing dependencies, you might start seeing error messages about any missing DLL files that wxpar didn't pick up. If that does happen, you can use the -l option to include any needed DLL files.

        Oh and btw, if I try to compile the .exe using ActiveStates PDK, the problem actually disappears (XML-RPC response is properly received).

        Both pp and ActiveState's PerlApp from their PDK are trying to catch all of the needed dependencies. However, I don't think that neither claim to be 100% perfect in doing so. That's why both have methods to allow the user to add in additional files and modules in case the tool misses anything. In the case of your code, it's possible that PerlApp is catching a dependency that wxpar missed or you might have used a PerlApp option that caused it to determine run-time dependencies. It's also possible that there could be scenarios where pp (and/or wxpar) could catch dependencies that PerlApp misses.

        The thing is my .exe actually runs successfully and WX GUI interface opens without any problems, so I don't think it's a windows DLL issue. .... Help...

        I tried to help, but you ignored my help, there is nothing left to do