Have you ever found little black beetles with yellow spots on your overripe garden fruit? These little buggers are called picnic beetles and are instantly attracted to your ripening sweet corn, berries, cracking melons, and tomatoes. They burrow into the fruit causing more damage.
The best idea for control is if you have these as problems, make a daily check on your melons and tomatoes. Harvest anything before it gets overripe. You might have to harvest a couple of days early.
Insecticides are not a good idea because you are too close to harvest. If really bad, try fruit juice with some vinegar and water into pie pans. The beetles will down themselves. Stale beer works also.