How do I secure electrical wiring to a pocket door frame?
My expectation when opening a door (either hinged or pocket) is that the switch is inside on the strike side of the door.  Strike side location would avoid the pocket door completely.
You are asking for trouble by routing the cable so near the surface. If you are trying to use NM cable, you would have to armor the cable the whole way up, because its not center stud (I believe within 1.25 inches of stud edge.

National Electrical Code 2011
ARTICLE 300 Wiring Methods
300.4 Protection Against Physical Damage.
(D) Cables and Raceways Parallel to Framing Members and Furring Strips. In both exposed and concealed locations, where a cable- or raceway-type wiring method is installed parallel to framing members, such as joists, rafters, or studs, or is installed parallel to furring strips, the cable or raceway shall be installed and supported so that the nearest outside surface of the cable or raceway is not less than 32 mm (11⁄4 in.) from the nearest edge of the framing member or furring strips where nails or screws are likely to penetrate. Where this distance cannot be maintained, the cable or raceway shall be protected from penetration by nails or screws by a steel plate, sleeve, or equivalent at least 1.6 mm (1⁄16 in.) thick.