sub new { # parameters: # [$this], # @attributes: tree, messageNum, messageText my ($this, @attributes) = @_; # "process" optional attributes my %attributes = ( tree => undef, messageNum => undef, messageText => undef, @attributes, ); # assert for valid argument list if ((keys %attributes) > 3) { die "invalid argument list during function call!\n"; } # assert mandatory parameters my $tree = $attributes{tree}; my $messageNum = $attributes{messageNum}; my $messageText = $attributes{messageText}; if ((!defined($this)) || (!defined($tree)) || (!defined($messageNum))) { die "invalid argument list during function call!\n"; }