(NEXSTAR) – Nothing dampens the mood of an early autumn afternoon like finding out your pumpkins are prematurely rotting on the porch.

Well, that, or finding out you’re running low on limited-edition pumpkin-spice-scented trash bags. That’s a real bummer too.

Picking out a hardy pumpkin isn’t exactly rocket science, but there are a few steps that folks can take to ensure a longer-lasting gourd, according to Dr. Rebecca Nelson Brown, the chair of Plant Sciences and Entomology at the University of Rhode Island.

“The key here is that you want the pumpkin to be as fresh as possible. And that means buying a locally grown pumpkin, and not one from the supermarket that has been picked a month before showing up at the store.”

Brown, who runs URI’s crops program and teaches its field production classes, has plenty of experience in pumpkins. She even spearheaded the university’s “Project Pumpkin,” which was designed to solve problems faced by farmers working near major metro areas.

Part of Project Pumpkin also concerned the consumer end, with Brown and her students — along with a volunteer team of master gardeners — hoping to determine which types of pumpkins would last the longest outside their front doors.

The results, however, weren’t so varied.

“What we found was there really were no differences on how long the pumpkins lasted on peoples’ porches,” Brown said, telling Nexstar that most “market classes” of pumpkin (i.e., the rounder, orange carving pumpkins commonly associated with Halloween) generally lasted a little over a month before rotting.

This one has a certain undeniable charm about him, though. (Getty Images)

But that’s only if you start with a good specimen from a local source. Brown recommended buying one from a nearby grower to ensure freshness. And consumers should look at the stems, she said, to make sure they’re not already soft, dried or shriveled, but rather firm, greenish-black and cleanly cut. Stems that aren’t so cleanly cut — whether they’re broken or ripped — are basically a “wound where bacteria can get in,” Brown said.

Premature rotting is also pretty much guaranteed once the pumpkin is carved.

“Any pumpkin, once you carve it, is not going to last very long,” Brown explained. “Which makes sense, because you’re taking this vegetable, which is wet, and has a fairly large sugar content, and you’re cutting holes in it. And when you do that, you’re inviting the fungi in, and it’s going to rot.”

Homeowners should also bring pumpkins inside when temperatures dip below freezing — whether carved or not — because they “turn into a pile of mush” when thawed, Brown said.

And at that point, those pumpkins are going to look better in your pumpkin-spice-scented trash bags than they are on your porch.

The easiest solution, according to Brown, is to put your pumpkins out whole in early October, and then carve them right before Halloween.

“Or, if you want something that can last longer, you can paint it,” she suggested.