Help for this page

Select Code to Download


  1. or download this
    sub add_node {
      my $self = shift;
    ...
      return if is_duplicate( $node ); # do nothing for dups
      # proceed to add node to the set of nodes for this tree
    }
    
  2. or download this
    sub add_node {
      my $self = shift;
      my $node = shift;
      return $self->{ N }{ $node->id } ||= $node;
    }
    
  3. or download this
    $tree->add_node( Node->new( $some_random_object, $id ) );
    
  4. or download this
    sub { my $node = shift; return "$node" }
    
  5. or download this
    sub add_node {
      my $self = shift;
    ...
      my $id_fxn = $self->id_fxn;
      return $id_fxn( $node );
    }
    
  6. or download this
    sub get_id {
      my $self = shift;
    ...
        ref $node && $node->can( 'id' ) ? $node->id
                                        : $self->id_fxn->( $node );
    }