Subject: | quote_sub overridability ( 391372c28e ) does not handle strictures on 5.8 |
Attached is a somewhat convoluted set of steps producing different output on 5.8 and 5.10+. I have an internal test that got tripped by this, figured sharing it before I work around is worthwhile.
Subject: | qsub.t |
{ use Moo 2.002 }
use warnings;
use strict;
use Data::Dumper;
use Sub::Quote 'quote_sub';
# only support qsub()-like for this particular test
sub quote_sub_around ($) {
my @caller = caller(0);
quote_sub( $_[0], {}, {
package => $caller[0],
hints => $caller[8],
warning_bits => $caller[9],
hinthash => $caller[10],
});
}
my $src = 'warn "I see a sub: " . *{"Sub::Quote::quote_sub"}{CODE}';
my $variants = do {
no strict 'refs';
{
direct => quote_sub( $src ),
around => quote_sub_around( $src ),
}
};
for (keys %$variants) {
my @w;
local $SIG{__WARN__} = sub { push @w, @_ };
eval { $variants->{$_}->() };
print Dumper { $_ => { warnings => \@w, exception => $@ } };
}