sub add_product { my ( $self, $data ) = @_; my $categoryID = $data->{categoryID}; delete $data->{categoryID}; $self->_generic_insert( $data, 'products', DONT_COMMIT ); return if $self->error; my %category = ( productID => $self->_get_identity, categoryID => $categoryID ); $self->_generic_insert( \%category, 'category_product', COMMIT ); }