Help for this page

Select Code to Download


  1. or download this
    sub foo;
    
    print( __PACKAGE__->can('foo') ?1:0,"\n");  # 1
    print( defined(&foo)           ?1:0,"\n");  # 0
    print( exists(&foo)            ?1:0,"\n");  # 1
    
  2. or download this
    my $method_ref = __PACKAGE__->can('foo');
    print( $method_ref && defined(&$method_ref) ?1:0,"\n");