Lookj up "level sets".

The wikipedia page "Point in Polygon" talks about algorithms that can be used when the polygon's coordinates are known.  The proposed solution of the length of a path following the fence along the fence (call it $d_0$) and a path following along the fence but maintaining a constant distance of $x=1$ meter (call it $d_1$) will work for a robot that can do the tasks you're asking of it.  However, the answer of the difference in length being $2 \pi \sim 6.28$ meters would only apply if the fence is perfectly circular.

Given a map or diagram of the fence, generate multiple contours or level sets of points which are a constant distance from the fence.  You'll end up with something that looks like a contour map or topographical map that the U.S. Geological surveys generates. Notice that for each distance $x$ (up to a certain limiting value), the level sets for $d_x$ may contain points inside the fence as well as outside the fence.  Once $x$ is greater than the radius of the circle, the level sets for $d_x$ such that $x \gt r$ will only contain points outside the circle.  For fences with concavities (like a pinched figure 8), the inner level set may break up into multiple non-connected paths.

If the fence is square, width edge length $2r$, then the close-fence contour $d_0$ will be $4 \times 2r = 8r$, whereas the 1-meter level set will be 

 - $4 \times (2r+2) = 8r + 4$ if the robot's path is 1-meter outside the fence

 - $4 \times (2r-2) = 8r - 4$ if the robot path is 1-meter inside the fence.

Thus for square, non-convex, and pretty much any noncircular fence, the level-set path one meter of the fence will not be $2 \pi \sim 6.28$ meters different from the level-set path of distance $0$ from the fence.

The generalization, however, will still apply that the level set path of distance $x$ away from the fence will be smaller ($d_x \lt d_0$) if the robot follows the level set path within the fence, vs. larger if the robot follows the level set path outside the fence ($d_x \gt d_0$).