in reply to is_constant() - a routine that detects constant subs

Here's a simpler routine that works with Perl 5.7.3. It doesn't work with Perl 5.6.1 because 5.6.1 doesn't have a CONST flag for CVs.

use B; use constant CONST => 0x0200; sub is_constant { no strict 'refs'; my $name = shift; my $code = *{$name}{CODE}; my $obj = B::svref_2object($code); return 1 if $obj->isa('B::CV') and $obj->CvFLAGS & CONST; return 0; }

I wonder why B doesn't offer constants for the values in FLAGS and CvFLAGS...

-sam