# reworked slightly, for conciseness. sub new { my %self; ( my $class, $self{qw( from_node to_node label )} ) = @_; bless \%self, $class; } #### sub new { @_ == 2 and die "Error: can't set just one of the links!"; my %self; ( my $class, $self{qw( from_node to_node label )} ) = @_; bless \%self, $class; } #### sub new { my %self; ( my $class, $self{qw( from_node to_node label )} ) = @_; $self{'from_node'} && ! $self{'to_node'} and die "Error: can't set just one of the links!"; bless \%self, $class; }