is_sub_constant#

Whether a sub is a constant perl inlines.

Synopsis#

use Sub::Identify qw(is_sub_constant);
use constant PI => 3.14159;
is_sub_constant(\&PI);              # true
is_sub_constant(sub () { $x });     # false: it closes over $x

What you get back#

True for a sub with an empty prototype that perl has made a constant - use constant, or sub () { LITERAL } - and false for everything else, including a non-reference.