Open ghost opened 6 years ago
$*PROGRAM-NAME is supposed to be a replacement for Perl 5's $0, but it doesn't work that way.
$*PROGRAM-NAME
$0
Current test does this, which is just creating a non-magical scoped dynvar:
use v6; my $*PROGRAM-NAME = 'foo'; say qqx`ps $*PID`; =output PID TTY STAT TIME COMMAND 6032 pts/1 Sl+ 0:00 /home/ant/perl6/install/bin/moar --execname=/home/ant/perl6/install/bin/perl6 --libpath=/home/ant/perl6/install/share/nqp/lib --libpath=/home/ant/perl6/install/share/nqp/lib --libpath=/home/ant/perl6/install/share/perl6/lib --libpath=/home/ant/perl6/install/share/perl6/runtime /home/ant/perl6/install/share/perl6/runtime/perl6.moarvm test.pl
What I'd expect to work:
use v6; $*PROGRAM-NAME = 'foo'; say `ps $$`; =output Cannot modify an immutable Str (test.pl) in block <unit> at test.pl line 2
What should happen:
use v5.26; $0 = "foo"; say `ps $$`; __DATA__ # PID TTY STAT TIME COMMAND # 5875 pts/1 S+ 0:00 foo
Opened a ticket for that problem: https://rt.perl.org/Ticket/Display.html?id=132194
$*PROGRAM-NAME
is supposed to be a replacement for Perl 5's$0
, but it doesn't work that way.Current test does this, which is just creating a non-magical scoped dynvar:
What I'd expect to work:
What should happen: