use warnings; use Inline C => Config => BUILD_NOISY => 1; use Inline C => <<'EOC'; SV * validate(CV * coderef) { if(CvOUTSIDE(coderef)) return newSVuv(1); return newSVuv(0); } EOC $cref1 = \&existent; $cref2 = \&non_existent; $foo = 'hello world'; print "\$cref1: ", validate($cref1), "\n"; print "\$cref2: ", validate($cref2), "\n"; print "\$foo: ", validate($foo), "\n"; # Fatal Error sub existent{}