  By seeing whether a Liouville type theorem holds for positive, bounded,
and/or finite energy $p$-harmonic and $p$-quasiharmonic functions, we classify
proper metric spaces equipped with a locally doubling measure supporting a
local $p$-Poincar\'e inequality. Similar classifications have earlier been
obtained for Riemann surfaces and Riemannian manifolds.
  We also study the inclusions between these classes of metric measure spaces,
and their relationship to the $p$-hyperbolicity of the metric space and its
ends. In particular, we characterize spaces that carry nonconstant $p$-harmonic
functions with finite energy as spaces having at least two well-separated
$p$-hyperbolic sequences. We also show that every such space $X$ has a function
$f \notin L^p(X) + \mathbb{R} $ with finite $p$-energy.
