In a mod_perl app, I execute a database transaction with a subroutine that takes a coderef as a parameter. Since closures can have bad effects and be hard to track down, I want the transaction sub to helpfully tell me when the coderef that's passed accidentally contains references to lexical variables in its original enclosing scope. I came up with
my $str = Data::Dumper->new([$coderef],['$a'])->Deparse(1);
eval $str;