Re: What is my sub?

2018-05-26 Thread ToddAndMargo
On 05/26/2018 10:41 PM, Xin Cheng wrote: Hi, Why does anyone want to know the name of the sub inside the sub itself? Is it more interesting to know the name of the calling sub? Thanks! Xin Hi Xin, This program check about 50 web sites to find new revisions of software I need to support my

Re: What is my sub?

2018-05-26 Thread Xin Cheng
Hi, Why does anyone want to know the name of the sub inside the sub itself? Is it more interesting to know the name of the calling sub? Thanks! Xin > On May 26, 2018, at 2:32 PM, Larry Wall wrote: > > On Fri, May 25, 2018 at 07:23:45PM -0700, ToddAndMargo wrote: > : Follow up: based on Yary

Re: What is my sub?

2018-05-26 Thread ToddAndMargo
On 05/26/2018 11:32 AM, Larry Wall wrote: On Fri, May 25, 2018 at 07:23:45PM -0700, ToddAndMargo wrote: : Follow up: based on Yary's wonderful advice, this is my keeper : on the subject: : : : : perl6: what is the name of the subroutine you are currently in: : : It is: : &?ROUTINE.name :

Re: What is my sub?

2018-05-26 Thread Larry Wall
On Fri, May 25, 2018 at 07:23:45PM -0700, ToddAndMargo wrote: : Follow up: based on Yary's wonderful advice, this is my keeper : on the subject: : : : : perl6: what is the name of the subroutine you are currently in: : : It is: : &?ROUTINE.name : callframe(0).code.name : : $ p6 'sub

Re: What is my sub?

2018-05-25 Thread ToddAndMargo
On 05/21/2018 11:04 PM, ToddAndMargo wrote: Hi All, I need to know the name of the subroutine I am in. This is the way I use to do it in Perl 5: (my $Name = (caller(0))[3] ) ~~ s{.*::}{}; How do I do it in Perl 6? Many thanks, -T Follow up: based on Yary's wonderful advice, thi

Re: What is my sub?

2018-05-22 Thread Elizabeth Mattijsen
> On 22 May 2018, at 09:41, ToddAndMargo wrote: > > On 05/21/2018 11:21 PM, Siavash wrote: >> https://www.nntp.perl.org/group/perl.perl6.users/2017/03/msg3423.html >> On 2018-05-22 06:04:47 GMT, ToddAndMargo wrote: >>> Hi All, >>> >>> I need to know the name of the subroutine I am in. >>> >>> T

Re: What is my sub?

2018-05-22 Thread ToddAndMargo
On 05/22/2018 09:34 AM, Elizabeth Mattijsen wrote: On 22 May 2018, at 09:41, ToddAndMargo wrote: On 05/21/2018 11:21 PM, Siavash wrote: https://www.nntp.perl.org/group/perl.perl6.users/2017/03/msg3423.html On 2018-05-22 06:04:47 GMT, ToddAndMargo wrote: Hi All, I need to know the name of the

Re: What is my sub?

2018-05-22 Thread ToddAndMargo
On 05/22/2018 09:09 AM, yary wrote: Oh this works too sub my-name-is-Sue () { say "Hi, ", &?ROUTINE.name } my-name-is-Sue; -y Thank you!

Re: What is my sub?

2018-05-22 Thread Elizabeth Mattijsen
> On 22 May 2018, at 09:41, ToddAndMargo wrote: > > On 05/21/2018 11:21 PM, Siavash wrote: >> https://www.nntp.perl.org/group/perl.perl6.users/2017/03/msg3423.html >> On 2018-05-22 06:04:47 GMT, ToddAndMargo wrote: >>> Hi All, >>> >>> I need to know the name of the subroutine I am in. >>> >>> T

Re: What is my sub?

2018-05-22 Thread yary
Oh this works too sub my-name-is-Sue () { say "Hi, ", &?ROUTINE.name } my-name-is-Sue; -y On Tue, May 22, 2018 at 8:59 AM, yary wrote: > I was surprised there isn't a cleaner way to get a sub/method names, and > found https://docs.perl6.org/language/5to6-perlfunc#caller > > Try this tasty mors

Re: What is my sub?

2018-05-22 Thread yary
I was surprised there isn't a cleaner way to get a sub/method names, and found https://docs.perl6.org/language/5to6-perlfunc#caller Try this tasty morsel who-am-i () { say "I'm ", callframe(0).code.name } who-am-i; -y On Tue, May 22, 2018 at 12:41 AM, ToddAndMargo wrote: > On 05/21/2018 11:2

Re: What is my sub?

2018-05-22 Thread ToddAndMargo
On 05/21/2018 11:21 PM, Siavash wrote: https://www.nntp.perl.org/group/perl.perl6.users/2017/03/msg3423.html On 2018-05-22 06:04:47 GMT, ToddAndMargo wrote: Hi All, I need to know the name of the subroutine I am in. This is the way I use to do it in Perl 5: (my $Name = (caller(0))

Re: What is my sub?

2018-05-21 Thread Siavash
https://www.nntp.perl.org/group/perl.perl6.users/2017/03/msg3423.html On 2018-05-22 06:04:47 GMT, ToddAndMargo wrote: > Hi All, > > I need to know the name of the subroutine I am in. > > This is the way I use to do it in Perl 5: > > (my $Name = (caller(0))[3] ) ~~ s{.*::}{}; > > How do I

What is my sub?

2018-05-21 Thread ToddAndMargo
Hi All, I need to know the name of the subroutine I am in. This is the way I use to do it in Perl 5: (my $Name = (caller(0))[3] ) ~~ s{.*::}{}; How do I do it in Perl 6? Many thanks, -T