sub _get_user_scenario { my ($self, $schema, $user_scenario) = @_; my $user_scenario_rs = undef; if(! ($user_scenario->{description} eq 'Not_exposed')) { eval { #get the number of user scenarios in the database table my $count = $schema->resultset("UserScenario")->count(); #insert user scenario, or if already in database, update the description $user_scenario_rs = $schema->resultset("UserScenario")->update_or_create( { name => $user_scenario->{name}, description => $user_scenario->{description}, }, { key => "u_user_scenario_name" }, ) || die "Unable to update/insert data to table UserScenario: $!\n"; }; } else { // I don't wants to insert the empty description and I don't wants to update the database for Not_exposed type of user scenario...So what I supposed to do here? // } if($@) { #warn(); $self->log_writer()->write_error_row("Unable to get/insert data to table UserScenario: $@"); return undef; } else { return $user_scenario_rs; } }