PerlAPP Problem to hidden $0, and arguments.

Posted by javier.vega@nossoftware.com on 2015-08-31 10:48
Forums: PDK discussion | OS: Linux

In my source code .pl, I put the following code to change the value of $ 0 to change the arguments:
($ 0 = "$ 0argv") = ~ s / p \ s + \ w + \ s / x /;

This works for me to run normally With PERL, but when I package with PerlApp, just change the name of the process and maintains the grounds. I need to change everything with arguments.

Someone could help me?

grahams
ActiveState Staff
Thu, 2015-10-29 08:45

It has always been the case. The reason is summed up by a comment from Ikegami back in 2005.
http://www.perlmonks.org/bare/?node_id=460514
"Since the Perl script and compiled Perl script were started with different commands, it's only normal for $0 to be different."

PerlApp provides Variables which can be used to help with needs like this:
http://docs.activestate.com/pdk/9.4/PerlApp.html#perlapp_variables

As an example, see this thread on the mailing list from 2003:
http://code.activestate.com/lists/pdk/%3C7344C71D555E2C47A522BE0A92C5483...