Tricky business managing one's melon. I'm convinced that as soon as any halfway serious player develops a serve and some fundamental shots, it's time to get to work on some mental aspects of the game.
In a similar way that we can only play a match with the skills we've developed for ourselves on the practice courts, it can also be essential to figure out our priorities for match day when we're away from the competitive settings. Instead of trying to stay motivated and execute good technique on the practice courts, "match mode" pushes us to keep a running inventory of what we're doing as well as what our opponents are doing. That's a skill that needs to be practiced, just like a spin serve or anything else.
I generally agree with our pals in terms of the idea of making a decision when you're playing a match. If you're "moody", you're letting the situation lead your emotions around by the nose. Once you decide what you're out there to do on the courts and work to remain focused on that, your moods will become much more of an afterthought, since they won't contribute toward playing the way you want.
This focus takes some significant discipline, but you can practice it like so many other things and it should come more naturally on game day. One of the most valuable lessons I learned from Vic Braden's book, Mental Tennis, was the importance of understanding our own expectations when we play the game so that we're not doomed to years of constant disappointment. They've got to be realistic. That book may be the one most valuable read I've enjoyed as a "tennis person" and I recommend it all the time (now available in paperback!).