Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (19 sloc) 0.659 kb
use v6;
use Test;
plan 4;
# L<S06/The C<&?ROUTINE> object/current routine name>
# L<S02/Names/Which routine am I in>
sub foo { return &?ROUTINE.name }
is(foo(), '&Main::foo', 'got the right routine name in the default package');
{
# This testcase might be really redundant
package Bar {
sub bar { return &?ROUTINE.name }
is(bar(), '&Bar::bar', 'got the right routine name outside the default package');
}
}
my $bar = sub { return &?ROUTINE.name };
is($bar(), '<anon>', 'got the right routine name (anon-block)');
my $baz = try { &?ROUTINE.name };
ok(not(defined $baz), '&?ROUTINE.name not defined outside of a routine');
# vim: ft=perl6
Jump to Line
Something went wrong with that request. Please try again.