The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
use Test::More tests => 1;

sub foo {

}

my @results;

sub dothis {
    my $op = $_[0];
    push @results, $op->name;
}

sub test {
    use B::OPCheck entersub => check => \&dothis;
    foo(1,2);
    printf "foo";
    foo("dancing");
    no B::OPCheck;
    foo(2,3);
}

is_deeply(\@results, [('entersub') x 2]);