This image generated from candy.rib uses four geometric primitives: two disks, a torus and a cylinder, each with their own parameter space. My first attempt used two different shaders because the cylinder and the torus have different parametrizations (I had to turn the cylinder by 90 degrees to make it fit to the torus, so the parameters are perpendicular too). Larry Gritz pointed out that it is easier to add another parameter ts to the shader so that only one shader is required: FHSpiral.sl.
Once the parametrization is done properly, you can easily add other features to the surface. The most obvious thing is to change the very smooth, plastic appearance and add a slightly irregular pattern to the normals. This is done with two and a half additional lines in the shader FHSpiral2.sl:
In POVRay you must either use several image_maps (which are difficult to generate in a way so that they connect smoothly on the borders between different parts of the object) or build the object from appropriately colored smaller objects. A candy-cane in POV, contributed by Steve Houchen, uses 360 checker-colored cylinders to produce the spiraling colors:
This gives reasonable results for low resolutions, but an increase in resolution reveals the disadvantages of this approach: