Self-template Synthesis of Metal Halide Perovskite Nanotubes as Functional Cavities for Tailored Optoelectronic Devices.