On Wed, Sep 13, 2017 at 8:15 PM, ToddAndMargo <toddandma...@zoho.com> wrote:
> Would this be what I am looking for? > > > for 1..* -> $level { > given callframe($level) -> $frame { > when $frame ~~ CallFrame { > next unless $frame.code ~~ Routine; > say $frame.code.package; > last; > } > default { > say "no calling routine or method found"; > last; > } > } > } > > And I can't put it in a pm6 or I would get the next > level down. > Presumably you'd just have to go up another level (or more since you also get frames for blocks). I'm unclear if you need to check if the code block produced is from a sub. pyanfar Z$ 6 'sub foo { my $x = callframe(0); dd $x.code.name }; sub bar { foo() }; bar()' "foo" pyanfar Z$ 6 'sub foo { my $x = callframe(1); dd $x.code.name }; sub bar { foo() }; bar()' "bar" pyanfar Z$ 6 'sub foo { my $x = callframe(2); dd $x.code.name }; sub bar { foo() }; bar()' "<unit>" -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net