package TreeNode; use strict; # new TreeNode() # new TreeNode( list of nodes ) sub new { my $caller = shift; my $class = ref($caller) || $caller; my $self = []; bless ($self, $class); $self->AddNode(@_) if @_; return $self; } # $obj->AddNode() # Creates a new TreeNode object, adds it to the tree, and returns said object. # $obj->AddNode(another node[, still another node, ...]) # Adds one or more existing TreeNode objects to the tree. sub AddNode { my $self = shift; @_ = $self->new unless @_; push @$self, @_; $_[0]; # return the first object added (so that AddNode() with no args returns the new node) } 1; # so the require or use succeeds #### $"=$,,$_=q>|\p4<6 8p .q>.<4-KI;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/