  We present a unified strategy to derive Hardy-Poincar\'e inequalities on
bounded and unbounded domains. The approach allows proving a general
Hardy-Poincar\'e inequality from which the classical Poincar\'e and Hardy
inequalities immediately follow. The idea also applies to the more general
context of variable exponent Sobolev spaces. The argument, concise and
constructive, does not require a priori knowledge of compactness results and
retrieves geometric information on the best constants.
