Perl 5's $0 vs. Perl 6's $*EXECUTABLE_NAME
I finally found the Perl 6 version of Perl 5's $0 listed in: tablets.perl6.org/appendix-b-grouped.html#special-variables as '$*EXECUTABLE_NAME', and I expected it to act the same as $0 in Perl 6, but I have two problems with it: 1. When used it yields 'perl6' regardless of the script's name (a bug?). $ cat t.pl #!/usr/bin/env perl6 say $*EXECUTABLE_NAME; $ chmod +x t.pl $ ./t.pl perl6 2. It seems very ungainly to go from two characters to 17. Couldn't it be shortened a bit, say, '$*0' or '$*EXE_NAME' or '$*PROG' or something else? Am I doing something wrong or do I have the wrong expectations? $ perl6 --version This is perl6 version 2015.03-48-g9746e88 built on MoarVM version 2015.03 Best regards, -Tom
Re: Perl 5's $0 vs. Perl 6's $*EXECUTABLE_NAME
On 30 May 2015 3:00:25 pm GMT+02:00, Tom Browder tom.brow...@gmail.com wrote: I finally found the Perl 6 version of Perl 5's $0 listed in: tablets.perl6.org/appendix-b-grouped.html#special-variables as '$*EXECUTABLE_NAME', and I expected it to act the same as $0 in Perl 6, but I have two problems with it: 1. When used it yields 'perl6' regardless of the script's name (a bug?). $ cat t.pl #!/usr/bin/env perl6 say $*EXECUTABLE_NAME; $ chmod +x t.pl $ ./t.pl perl6 2. It seems very ungainly to go from two characters to 17. Couldn't it be shortened a bit, say, '$*0' or '$*EXE_NAME' or '$*PROG' or something else? Am I doing something wrong or do I have the wrong expectations? $ perl6 --version This is perl6 version 2015.03-48-g9746e88 built on MoarVM version 2015.03 Best regards, -Tom Hi Tom, I believe what you are looking for is called $*PROGRAM_NAME. See also http://doc.perl6.org/language/variables#Special_Variables Cheers, Paul
Re: Perl 5's $0 vs. Perl 6's $*EXECUTABLE_NAME
Please also take a look at $*EXECUTABLE, $*PROGRAM and $*PROGRAM_NAME. Am 30.05.2015 um 15:00 schrieb Tom Browder: I finally found the Perl 6 version of Perl 5's $0 listed in: tablets.perl6.org/appendix-b-grouped.html#special-variables as '$*EXECUTABLE_NAME', and I expected it to act the same as $0 in Perl 6, but I have two problems with it: 1. When used it yields 'perl6' regardless of the script's name (a bug?). $ cat t.pl #!/usr/bin/env perl6 say $*EXECUTABLE_NAME; $ chmod +x t.pl $ ./t.pl perl6 2. It seems very ungainly to go from two characters to 17. Couldn't it be shortened a bit, say, '$*0' or '$*EXE_NAME' or '$*PROG' or something else? Am I doing something wrong or do I have the wrong expectations? $ perl6 --version This is perl6 version 2015.03-48-g9746e88 built on MoarVM version 2015.03 Best regards, -Tom
Re: Perl 5's $0 vs. Perl 6's $*EXECUTABLE_NAME
On Sat, May 30, 2015 at 8:30 AM, Tobias Leich em...@froggs.de wrote: Please also take a look at $*EXECUTABLE, $*PROGRAM and $*PROGRAM_NAME. Tobias, I didn't find $*PROGRAM in the doc listed by Paul: http://doc.perl6.org/language/variables#Special_Variables Also, the following were not in: http://tablets.perl6.org/appendix-a-index.html that I could find. $*EXECUTABLE_NAME $*PROGRAM $*PROGRAM_NAME From a Perl 6 newbie standpoint, it looks like there are too many docs with overlapping purposes referenced on perl.org and which, confusingly, have different pieces missing. Except for the Synopses, I'm not sure what document to go to for the definitive answer. And, as usual, I have no suggestions for an easy fix. Thanks Paul and Tobias. Best, -Tom
Re: Perl 5's $0 vs. Perl 6's $*EXECUTABLE_NAME
Hi Tom, On Sat, May 30, 2015 at 09:03:17AM -0500, Tom Browder wrote: On Sat, May 30, 2015 at 8:30 AM, Tobias Leich em...@froggs.de wrote: Please also take a look at $*EXECUTABLE, $*PROGRAM and $*PROGRAM_NAME. Tobias, I didn't find $*PROGRAM in the doc listed by Paul: http://doc.perl6.org/language/variables#Special_Variables Also, the following were not in: http://tablets.perl6.org/appendix-a-index.html that I could find. $*EXECUTABLE_NAME $*PROGRAM $*PROGRAM_NAME the docs at tablets.perl6.org aren't as up to date as those on doc.perl6.org. The doc.perl6.org docs are currently the reference work for Perl6, however please note that they are very much a work in progress. From a Perl 6 newbie standpoint, it looks like there are too many docs with overlapping purposes referenced on perl.org and which, confusingly, have different pieces missing. Except for the Synopses, I'm not sure what document to go to for the definitive answer. And, as usual, I have no suggestions for an easy fix. This I can understand. We're doing our best to provide current and accurate documentation. Perl6 is a very large language, and thus gaps in the documentation are to be expected; especially considering the volunteer based nature of the project. Thanks for pointing out the $*PROGRAM omission! I've just added it to the list of special variables and it should be available online within the next 10-15 minutes. Kind regards, Paul
Re: Perl 5's $0 vs. Perl 6's $*EXECUTABLE_NAME
On Sat, May 30, 2015 at 9:03 AM, Tom Browder tom.brow...@gmail.com wrote: On Sat, May 30, 2015 at 8:30 AM, Tobias Leich em...@froggs.de wrote: Please also take a look at $*EXECUTABLE, $*PROGRAM and $*PROGRAM_NAME. Tobias, I didn't find $*PROGRAM in the doc listed by Paul: But it is the only one of the group I found in Synopsis 28 (Special names). In S28 I did find the Perl 5 to Perl 6 translation table in which I had overlooked $0 before. -Tom
Re: Perl 5's $0 vs. Perl 6's $*EXECUTABLE_NAME
Hi, On 05/30/2015 04:36 PM, Paul Cochrane wrote: Thanks for pointing out the $*PROGRAM omission! I've just added it to the list of special variables and it should be available online within the next 10-15 minutes. Minor nit pick: according to the last log on http://doc.perl6.org/build-log/ building the docs alone takes ~17min; the cron job runs every 5 minutes, so it's more likely 17-22min before it becomes available :-) And thanks for adding $*PROGRAM to the docs! Cheers, Moritz