In my last journal entry, I described a trick using subroutine attributes to annotate the compatibility version of a test in a test suite. I discovered that my trick didn't work for subclasses. This is a correction to make it work in that scenario.
sub Introduced : ATTR(CODE) {
my ($class, $symbol, $code_ref, $attr, $introduced_version) = @_;
# Wrap the sub in a version test
no warnings 'redefine';
*{$symbol} = sub {
no strict 'refs';
local
${$class.'::TODO'}
= $_[0]->_compatible($introduced_version);
$code_ref->(@_);
};
}