My wife and I have only began touring two years ago and those would be week long CC tours Inn to Inn. When we have a dog come out at us, the first thing that I have found works is to put the bike between us and the dog, have the spray at ready, and we offen yell to the dog "go get your ball". Funny how offen that has worked. Seams that once "the chase" is gone, they tend to back off and when we've yelled a common comand such as "get your ball", some confusion sets in. We've even had a lab go back and run around his yard looking for the ball.
A pack of dogs would be a totally different story and not too sure how we'd handle that. We are looking into getting a horn and carry that along with our spray.
Have no experience with bears but pretty sure they wouldn't run around looking for their ball.
Hope this helps.