use overload '""' => sub { shift->to_string };

sub to_string{
 my $self = shift;
 return "name: $self->{name}, weight: $self->{weight}";
}