use strict; use warnings; use B::Deparse; sub debug_coderef { my $possibly_code = shift; my $deparse = B::Deparse->new(); if (ref $possibly_code && ref $possibly_code eq 'CODE') { print STDERR "CODEREF: ", $deparse->coderef2text($possibly_code), "\n"; } else { print STDERR "NOT A CODEREF: ", Dumper($possibly_code), "\n"; } } debug_coderef(sub {print "a";});
No comments:
Post a Comment