# a heuristic with ambiguous eval and looking for octets in the stash
use if $] >= 5.016, feature => 'unicode_eval';
+if ($] >= 5.008) {
+ my $builder = Test::More->builder;
+ binmode $builder->output, ":encoding(utf8)";
+ binmode $builder->failure_output, ":encoding(utf8)";
+ binmode $builder->todo_output, ":encoding(utf8)";
+}
+
sub compile_named_sub {
my ( $fullname, $body ) = @_;
my $sub = eval "sub $fullname { $body }" . '\\&{$fullname}';
#######################################################################
+use Sub::Name 'subname';
+
my @ordinal = ( 1 .. 255 );
# 5.14 is the first perl to start properly handling \0 in identifiers
0x1f4a9, # PILE OF POO
unless $] < 5.008;
-plan tests => @ordinal * 2;
+plan tests => @ordinal * 2 * 2;
my $legal_ident_char = "A-Z_a-z0-9'";
$legal_ident_char .= join '', map chr, 0x100, 0x498
my $subname = sprintf 'SOME_%c_NAME', $ord;
my $fullname = join '::', $pkg, $subname;
+ $sub = subname $fullname => sub { (caller(0))[3] };
+ caller3_ok $sub, $fullname, 'renamed closure', $ord;
+
# test that we can *always* compile at least within the correct package
my $expected;
if ( chr($ord) =~ m/^[$legal_ident_char]$/o ) { # compile directly