That really should work as you describe ... Perhaps you could post the offending code which would make it infinitely easier for fellow monks to debug. Also, if you want to save yourself the trouble of having to call external scripts you could make use of the HTML::CalendarMonth module or simpler still the HTML::Calendar::Simple module.
HTH