I don't use that technique. In fact, I think that's a terrible technique, so I think that your dog will bolt as soon as you're not there to administer the punishment.
My yard is fenced most of the way around (The first step to training the dog is MANAGEMENT). They can't get out except in areas that I permit them.
Then I take my dog on a leash with me and when we get near the edge of the property (not AT the property line, but near the edge, about 5 ft back), I ask for my dog to sit, and a wait. When she does, I walk into the street, while she waits. Then I come back for her and I reward. I release her, then we enter the street and go for a walk. Sometimes, we go back to the yard and we play. Often I do this in conjunction with clicker training, if I've thought far enough to have my clicker with me.
Little by little, I bring my dog closer to the property line. Whenever we go for a walk, or we just cross the street to get the mail, I always ask for a sit, wait then I come back. I always reward it profusely. Then we continue. When I'm working in the yard, we practice this. I have high value treats. The edge of the property is clearly marked, but I always stop her about 2 ft back.
Then I work on standing waits. Same thing. Standing wait. Reward. Release (sometimes to go back into the yard, sometimes to continue on a walks. But *I* release her, so she knows that she doesn't go in the street on her own EVER). Then we work on moving waits. Same procedure, and we work on moving waits constantly for a long time.
Sometimes, rewards are treats. Sometimes, rewards are playing their favorite games. Often, rewards are going for a walk. And often, rewards are two or all three of these.
Very quickly, my dogs learn that stopping at the property line is a GOOD thing. And they learn they don't go into the street without me (or Dh).
My older dogs are reliable. Zamboni, has for years, sat on the edge of the driveway and watched squirrels in the neighbor's yard across the street. We joke that she must be telling him "you know, Squirrel. I'm a mean dog and I would mess you up, but I'm not allowed to cross the street." She'll sit in the driveway while dogs go by. Sometimes, she'll stand and wag her tail at them, or bark a couple woofs, but she doesn't leave the driveway. My other dogs learned this too. (It takes maturity to get it to be 100% reliable). My younger dog is learning this now.
TJ is right. We should never count on our dogs to stop at the property line. My dogs are never outside unsupervised. But sometimes, stuff happens. I've opened the front door to let the kids out only to find that some door-to-door solicitor has left the front gate wide open. With my training, my dogs won't bolt. They know the property line is a magical place where if they stop, wonderful things happen to them.
Your approach just doesn't teach that.