You must be doing something wrong then:
> sub LinuxCheck () { print &?ROUTINE.name ~ " " ~ "$*DISTRO OS\n"; }
sub LinuxCheck () { #`(Sub|140478449412680) ... }
> LinuxCheck();
LinuxCheck macosx OS
On Tue, Mar 7, 2017 at 11:54 PM, ToddAndMargo <[email protected]> wrote:
> On Tue, Mar 7, 2017 at 11:30 PM, ToddAndMargo <[email protected]
>>> <mailto:[email protected]>> wrote:
>>>
>>> Hi All,
>>>
>>> I am trying to print out the name of the sub I am in.
>>>
>>> Reference:
>>>
>>> https://docs.perl6.org/language/variables#index-entry-%26%3FROUTINE
>>> <https://docs.perl6.org/language/variables#index-entry-%26%3FROUTINE
>>> >
>>> &?ROUTINE Which routine am I in?
>>>
>>>
>>> <code>
>>> sub LinuxCheck () { print &?ROUTINE ~ " " ~ "$*DISTRO $OS\n"; }
>>> </code>
>>>
>>> <unit> rhel linux
>>>
>>> &?ROUTINE resolves to "<unit>", which is not the name of the sub.
>>> What am I missing?
>>>
>>>
>>> Many thanks,
>>> -T
>>>
>>
> On 03/07/2017 11:42 PM, Brent Laabs wrote:
>
>> Try &?ROUTINE.name -- that should get you the sub's name.
>>
>>
> Hi Brent,
>
> Still prints "<unit>". Rats!
>
> Thank you for the help!
> -T
>