On Tue, Mar 7, 2017 at 11:54 PM, ToddAndMargo <toddandma...@zoho.com
<mailto:toddandma...@zoho.com>> wrote:

            On Tue, Mar 7, 2017 at 11:30 PM, ToddAndMargo
            <toddandma...@zoho.com <mailto:toddandma...@zoho.com>
            <mailto:toddandma...@zoho.com
            <mailto:toddandma...@zoho.com>>> 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>

            <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



On 03/08/2017 12:01 AM, Brent Laabs wrote:
You must be doing something wrong then:

sub LinuxCheck () { print &?ROUTINE.name ~ " " ~ "$*DISTRO OS\n"; }
sub LinuxCheck () { #`(Sub|140478449412680) ... }
LinuxCheck();
LinuxCheck macosx OS



I am.  I wrote a three lines as a proof and it worked.  Time
to clean my glasses!

Thank you for all the help!

Reply via email to