Help for this page

Select Code to Download


  1. or download this
    # Parent
    sub get_child_id {
    ...
      # Find the index of the child. Left as exercise for the reader (read
    +: I'm too lazy :) ).
      return $child_index;
    }
    
  2. or download this
    # Child
    sub whereami {
    ...
      my $id=$parent->get_child_id($self);
    
    }
    
  3. or download this
    my $self = {
          parent => \$parent;
       };
    
  4. or download this
    my $self= { parent => $parent }; #$parent is a ref, you were storing a
    + ref to $parent