Help for this page

Select Code to Download


  1. or download this
    use Scalar::Util qw(blessed);
    my $is_code = blessed($code) ? $code->can('&{}') : ref($code) eq 'CODE
    +';
    
  2. or download this
    my $is_code = ! blessed($code)
                ? ref($code) eq 'CODE'
                : $code->can('&{}')
                  || $code->isa('CODE') # arguably not a good test (bless 
    +{}, 'CODE')
                  || eval { defined &$code }; # arguably bad because it ge
    +ts called in some contexts