Help for this page

Select Code to Download


  1. or download this
    my $obj = MyClass->new();  # what if it returns undef on error?
    if ($obj->can('top')       # dies!
    
  2. or download this
    # Instead of:
        if (UNIVERSAL::isa($obj, 'MyClass')
    # do this:
    ...
    # do this:
        if (blessed $obj && $obj->can('top')
        &&  blessed $obj->top && $obj->top->can('bottom'))