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

When calling perl -w param.pl *.zip the output is p_sDirmask: #*.zip#.

I used perl2exe to create a perl-standalone executable. When passing the same to param.exe the output is Somefile.zip.
*.zip seems to get interpreted before passed to the origin-perl-code.

param.pl:
#!/usr/bin/perl# use strict; use warnings; # Uebergabe-Parameter pruefen if ( !defined( $ARGV[0] ) ) { print "Example: param.exe <Filemask>\n"; print "\n"; exit; } my $p_sDirmask = $ARGV[0]; print "p_sDirmask: #$p_sDirmask#\n";
Compiler call: perl2exe.exe -v param.pl

Am I doing something wrong?
How to handle parameters when using perl2exe? Or does perl2exe have some trouble here?

Environment:
Windows 10 Professional 64-Bit
Strawberry Perl 5.24.1.1 64-Bit
Perl2Exe 24.00-Win

Replies are listed 'Best First'.
Re: Parameters incorrect interpreted when passed to perl-standalone
by marto (Cardinal) on Mar 15, 2017 at 12:57 UTC

    Stop using perl2exe (consider the licence etc), use pp:

    pp -x yar.pl -o yar.exe ... yar.exe *.zip p_sDirmask: #*.zip#
      We are going to buy a license as soon as we know if it works for our scripts.

      The decision wasn't mine. I just have to do the research and work with it.
        > We are going to buy a license as soon as we know if it works for our scripts.

        The main advantage of a commercial product over an open source solution is guaranteed support.

        Look, if they can't help you and you can't even get advice here, what's left then?

        You should certainly escalate this question to management.

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

        Then you should probably speak to them regarding support of their product.

        I agree with marto recommendation, eventhough the decision is not yours, you can convey the advantage of using PP instead of perl2exe and the cost benefit it has.
        The decision maker may change the decision since PP is having valid advantages comparing to perl2exe.
Re: Parameters incorrect interpreted when passed to perl-standalone
by Anonymous Monk on Mar 16, 2017 at 03:12 UTC

    Hi,

    I think the "*.zip" is definitely being expanded by the operating system before the perl program is called on it.

    Why the compiled version is getting a different result I don't understand.

    Or have I got the wrong end of the stick again?

    J.C.

      " think the "*.zip" is definitely being expanded by the operating system before the perl program is called on it."

      Why? It works as expected with the same script packaged using a different tool? "I think" followed by "definitely" muddy the waters here :)

      "I think the "*.zip" is definitely being expanded by the operating system before the perl program is called on it."

      You're correct with the problem on the compiled version. perl -w param.pl *.zip just works fine.

        Try Win32::Autoglob

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)