I agree with J.M.: don't use recursion if you don't need it. I was just running a benchmark when he posted his answer.
PeriodicExtension[g_, x_] := If[Abs[x] < Pi, g[x], PeriodicExtension[g, x - 2 Sign[x] Pi]];
g[x_] := x^3
Timing[Plot[PeriodicExtension[g, x], {x, 0, 1000 Pi}]]
{ 9.922 }
PeriodicExtension[g_, x_] := g[Mod[x + Pi, 2 Pi] - Pi];
g[x_] := x^3
Timing[Plot[PeriodicExtension[g, x], {x, 0, 1000 Pi}]]
{ 0.234 }
The non-recursive version runs 42 times faster! (For an interval of 10 000 Pi even 100 times.) What's worse is that the recursion fails for large intervals. The recursive version for an interval [0, 100 000] gives this plot:
whereas the non-recursive one gives

still within 0.4 seconds.
gand makes it one that has period2π. It works recursively, so ifxis greater thanπ, for instance, it subtracts2πrepeatedly tillxfalls within the range-π < x < πand then evaluatesg[x]– rm -rf♦ Aug 27 '12 at 23:06