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
In reply to Re: is_constant() - a routine that detects constant subs
by samtregar
in thread is_constant() - a routine that detects constant subs
by samtregar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |