sub collapse { my $self = shift; # Start with the hash of attributes my $attr = shift; $attr = $self->new_hashref() unless %$attr; # <-- add this line