Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Very Odd Issue When Using pp to Create an .exe File Including Date::Calc

by marto (Cardinal)
on Jun 27, 2017 at 15:43 UTC ( [id://1193707]=note: print w/replies, xml ) Need Help??


in reply to Very Odd Issue When Using pp to Create an .exe File Including Date::Calc

I don't have access to a Windows machine right now, I usually recomend running pp with the -x flag:

pp -x -o 1193701.exe 1193701.pl

On Linux I created example exes using pp with and without -x, as you can see there's differences in what is being packaged:

rwxrwxr-x 1 marto marto 149 Jun 27 16:31 1193701_oneline.pl -rwxrwxr-x 1 marto marto 148 Jun 27 16:31 1193701_twolines.pl -rwxr-xr-x 1 marto marto 3322431 Jun 27 16:32 oneline.exe -rwxr-xr-x 1 marto marto 3417012 Jun 27 16:32 oneline_x.exe -rwxr-xr-x 1 marto marto 3428235 Jun 27 16:34 twolines.exe -rwxr-xr-x 1 marto marto 3428929 Jun 27 16:34 twolines_x.exe

Note the different sizes. Runtime:

marto@netbook:~/perlmonks$ ./oneline.exe Can't locate Date/Calc.pm in @INC (you may need to install the Date::C +alc module) (@INC contains: /tmp/par-6d6172746f/cache-c93faf27fca57f9 +a6de63ed7af3cc18b152dad8a/inc/lib /tmp/par-6d6172746f/cache-c93faf27f +ca57f9a6de63ed7af3cc18b152dad8a/inc CODE(0x9ffa574) CODE(0x9ffa740)) +at script/1193701_oneline.pl line 4. BEGIN failed--compilation aborted at script/1193701_oneline.pl line 4. marto@netbook:~/perlmonks$ ./oneline_x.exe FINISHED marto@netbook:~/perlmonks$ ./twolines.exe FINISHED marto@netbook:~/perlmonks$ ./twolines_x.exe FINISHED

Clearly, the one line of use... example isn't packaging Date::Calc when called without the -x option. The good thing about the executables created is that they are zip archives you can extract and examine the differences. If I get time later I'll do some more digging, but this should be a reasonable avenue for investigation.

1193701_oneline.pl:

#!/usr/bin/perl use utf8; use 5.022; use strict; use List::Util qw(max); use Date::Cal +c qw(Delta_Days); say "FINISHED"; my $pause_here = <STDIN>;

1193701_twolines.pl

#!/usr/bin/perl use utf8; use 5.022; use strict; use List::Util qw(max); use Date::Calc qw(Delta_Days); say "FINISHED"; my $pause_here = <STDIN>;

Replies are listed 'Best First'.
Re^2: Very Odd Issue When Using pp to Create an .exe File Including Date::Calc
by perldigious (Priest) on Jun 27, 2017 at 19:06 UTC

    Thanks for the tip marto, when I run pp -x -o my_name.exe my_script.pl it runs the script in my command line output and then ultimately the .exe does work (even with every use on one line). I'll take that advice about the -x switch for pp in the future.

    I didn't even know the .exe files created could be extracted like zip files, though I'm not sure I'm equipped with the know-how to go about debugging the differences and figuring out why one works over the other.

    This isn't a crucial issue or anything since I did figure out a way to make it work (now I have two ways thanks to your -x suggestion), it just made me turn my head sideways with a funny look that simply adding the newline fixed the problem... very odd to me, since I wouldn't have thought that should matter at all.

    Just another Perl hooker - But the purist monks keep telling me I should do it for love, not money.

      I'm mobile at the moment, so can't test further right now. However, a few things. Calling pp with -vvv this enables the highest level of verbose output. With the -L flag, provided with a file name this becomes the log for output, rather that stdout. See the documentation for various options. You could enable logging to discover the packaging process, compare the process for the different options and track down the reason from there. Similarly, extracting each exe into a directory will allow you to explore and compare the output. Comparing logs is probably easier :)

        Cool, and no worries, mobile or not it's nice of you to take a look at it at all. I always just use "> some_log_name.txt" at the end of any Windows command line input when I want to shunt to some log file instead of STDOUT, but of course if the script expects inputs you have to know them and the order they are expected since the prompts are shunted there as well. :-)

        Just another Perl hooker - But the purist monks keep telling me I should do it for love, not money.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1193707]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-25 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found