sub group_create { my ( $self, $group ) = @_; my $DB = $self->{DB}; # Check for group with same name my $old_group = $DB->record_search( $self->{group_profile}, { groupname => $group->{groupname} } ); return undef if @$old_group; $DB->record_insert( $self->{group_profile}, $group ); my $new_group = $DB->record_search( $self->{group_profile}, { groupname => $group->{groupname} } ); die "Failed to find newly created group\n" unless @$new_group == 1; # Copy the fields of the new user back in this one while ( my ($name,$value) = each %{$new_group->[0]} ) { $group->{$name} = $value; } return $group; }